summaryrefslogtreecommitdiff
path: root/emacs/guix-utils.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-11-17 22:19:14 +0300
committerAlex Kost <alezost@gmail.com>2016-01-02 17:25:35 +0300
commitceea647c72cac582126688c71e19e4c9f9137a63 (patch)
tree0b7b573b9d0aa8714be58ec63b7cfd03ad71f33f /emacs/guix-utils.el
parent73ce3c19c435db51ec818ec62a75e0956b31899f (diff)
downloadpatches-ceea647c72cac582126688c71e19e4c9f9137a63.tar
patches-ceea647c72cac582126688c71e19e4c9f9137a63.tar.gz
emacs: Simplify defining parameter titles.
* emacs/guix-utils.el (guix-symbol-title): New procedure. * emacs/guix-base.el (guix-get-param-title): Use it. (guix-param-titles): Remove most titles as they are automatically defined by 'guix-symbol-title'.
Diffstat (limited to 'emacs/guix-utils.el')
-rw-r--r--emacs/guix-utils.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index 5a0cad4f2a..e24b58fb17 100644
--- a/emacs/guix-utils.el
+++ b/emacs/guix-utils.el
@@ -165,6 +165,15 @@ This function is similar to `shell-quote-argument', but less strict."
(replace-regexp-in-string
(rx (not (any alnum "-=,./\n"))) "\\\\\\&" argument))))
+(defun guix-symbol-title (symbol)
+ "Return SYMBOL's name, a string.
+This is like `symbol-name', but fancier."
+ (if (eq symbol 'id)
+ "ID"
+ (let ((str (replace-regexp-in-string "-" " " (symbol-name symbol))))
+ (concat (capitalize (substring str 0 1))
+ (substring str 1)))))
+
(defun guix-command-symbol (&optional args)
"Return symbol by concatenating 'guix' and ARGS (strings)."
(intern (guix-concat-strings (cons "guix" args) "-")))