[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/38: emacs: Simplify defining parameter titles.
From: |
Alex Kost |
Subject: |
04/38: emacs: Simplify defining parameter titles. |
Date: |
Sat, 02 Jan 2016 14:27:17 +0000 |
alezost pushed a commit to branch master
in repository guix.
commit ceea647c72cac582126688c71e19e4c9f9137a63
Author: Alex Kost <address@hidden>
Date: Tue Nov 17 22:19:14 2015 +0300
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'.
---
emacs/guix-base.el | 46 +++++-----------------------------------------
emacs/guix-utils.el | 9 +++++++++
2 files changed, 14 insertions(+), 41 deletions(-)
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 7055a09..43dec3d 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -41,48 +41,14 @@
(defvar guix-param-titles
'((package
- (id . "ID")
- (name . "Name")
- (version . "Version")
- (source . "Source")
- (license . "License")
- (synopsis . "Synopsis")
- (description . "Description")
- (home-url . "Home page")
- (outputs . "Outputs")
- (inputs . "Inputs")
- (native-inputs . "Native inputs")
- (propagated-inputs . "Propagated inputs")
- (location . "Location")
- (installed . "Installed"))
+ (home-url . "Home page"))
(installed
- (path . "Installed path")
- (dependencies . "Dependencies")
- (output . "Output"))
+ (path . "Installed path"))
(output
- (id . "ID")
- (name . "Name")
- (version . "Version")
- (source . "Source")
- (license . "License")
- (synopsis . "Synopsis")
- (description . "Description")
(home-url . "Home page")
- (output . "Output")
- (inputs . "Inputs")
- (native-inputs . "Native inputs")
- (propagated-inputs . "Propagated inputs")
- (location . "Location")
- (installed . "Installed")
- (path . "Installed path")
- (dependencies . "Dependencies"))
+ (path . "Installed path"))
(generation
- (id . "ID")
- (number . "Number")
- (prev-number . "Previous number")
- (current . "Current")
- (path . "Path")
- (time . "Time")))
+ (prev-number . "Previous number")))
"List for defining titles of entry parameters.
Titles are used for displaying information about entries.
Each element of the list has a form:
@@ -93,9 +59,7 @@ Each element of the list has a form:
"Return title of an ENTRY-TYPE entry parameter PARAM."
(or (guix-assq-value guix-param-titles
entry-type param)
- (prog1 (symbol-name param)
- (message "Couldn't find title for '%S %S'."
- entry-type param))))
+ (guix-symbol-title param)))
(defun guix-get-name-spec (name version &optional output)
"Return Guix package specification by its NAME, VERSION and OUTPUT."
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index 5a0cad4..e24b58f 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) "-")))
- branch master updated (b989390 -> 1ae858f), Alex Kost, 2016/01/02
- 02/38: emacs: Add 'guix-with-indent'., Alex Kost, 2016/01/02
- 05/38: emacs: list: Generate numerical sort predicates., Alex Kost, 2016/01/02
- 01/38: emacs: Use "cl-list*" instead of "apply #'list"., Alex Kost, 2016/01/02
- 04/38: emacs: Simplify defining parameter titles.,
Alex Kost <=
- 09/38: emacs: Add 'guix-alist-put'., Alex Kost, 2016/01/02
- 07/38: emacs: list: Configure format in one place., Alex Kost, 2016/01/02
- 12/38: emacs: list: Generalize 'sort-key' code., Alex Kost, 2016/01/02
- 15/38: emacs: list: Factorize "edit package" commands., Alex Kost, 2016/01/02
- 08/38: emacs: Add 'guix-keyword-args-let'., Alex Kost, 2016/01/02
- 10/38: emacs: list: Generalize 'marks' code., Alex Kost, 2016/01/02
- 13/38: emacs: list: Add 'guix-list-mode-initialize'., Alex Kost, 2016/01/02
- 03/38: emacs: Add API for 'guix-entry'., Alex Kost, 2016/01/02
- 06/38: emacs: Rename internal procedures., Alex Kost, 2016/01/02
- 11/38: emacs: list: Generalize 'describe' code., Alex Kost, 2016/01/02