aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-12-09 21:58:36 +0300
committerAlex Kost <alezost@gmail.com>2016-01-02 17:25:35 +0300
commite29d19248483d2ac527894ca20fa69f88fabdfd3 (patch)
treecd60755e12958b9d4a33368399472d8e0cbde106 /emacs
parentc80ce104bed39157347078020cbc45c65ff9b893 (diff)
downloadguix-e29d19248483d2ac527894ca20fa69f88fabdfd3.tar.gz
guix-e29d19248483d2ac527894ca20fa69f88fabdfd3.zip
emacs: Add 'list-single' variables.
* emacs/guix-list.el (guix-list-single-entry?): New procedure. (guix-list-define-interface): Add ':list-single?' key and generate 'guix-ENTRY-TYPE-list-single' variables. * emacs/guix-ui-package.el (guix-package-list-single): Remove.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/guix-list.el18
-rw-r--r--emacs/guix-ui-package.el6
2 files changed, 18 insertions, 6 deletions
diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index 719642ad07..8b37a88615 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -97,6 +97,10 @@ This alist is filled by `guix-list-define-interface' macro.")
"Return alist of additional marks for ENTRY-TYPE."
(guix-list-value entry-type 'marks))
+(defun guix-list-single-entry? (entry-type)
+ "Return non-nil, if a single entry of ENTRY-TYPE should be listed."
+ (guix-list-value entry-type 'list-single))
+
(defun guix-list-describe-warning-count (entry-type)
"Return the maximum number of ENTRY-TYPE entries to describe."
(guix-list-value entry-type 'describe-count))
@@ -422,6 +426,9 @@ Optional keywords:
- `:describe-function' - default value of the generated
`guix-ENTRY-TYPE-describe-function' variable.
+ - `:list-single?' - default value of the generated
+ `guix-ENTRY-TYPE-list-single' variable.
+
- `:marks' - default value of the generated
`guix-ENTRY-TYPE-list-marks' variable.
@@ -436,6 +443,7 @@ The rest keyword arguments are passed to
"-describe-warning-count")))
(format-var (intern (concat prefix "-format")))
(sort-key-var (intern (concat prefix "-sort-key")))
+ (list-single-var (intern (concat prefix "-single")))
(marks-var (intern (concat prefix "-marks"))))
(guix-keyword-args-let args
((show-entries-val :show-entries-function)
@@ -443,6 +451,7 @@ The rest keyword arguments are passed to
(describe-count-val :describe-count 10)
(format-val :format)
(sort-key-val :sort-key)
+ (list-single-val :list-single?)
(marks-val :marks))
`(progn
(defcustom ,format-var ,format-val
@@ -485,6 +494,14 @@ Alist of additional marks for 'list' buffer with '%s' entries.
Marks from this list are used along with `guix-list-default-marks'."
entry-type-str))
+ (defcustom ,list-single-var ,list-single-val
+ ,(format "\
+If non-nil, list '%s' entry even if it is the only matching result.
+If nil, show a single '%s' entry in the 'info' buffer."
+ entry-type-str entry-type-str)
+ :type 'boolean
+ :group ',group)
+
(defcustom ,describe-count-var ,describe-count-val
,(format "\
The maximum number of '%s' entries to describe without a warning.
@@ -504,6 +521,7 @@ See also `guix-list-describe'."
(describe-count . ,describe-count-var)
(format . ,format-var)
(sort-key . ,sort-key-var)
+ (list-single . ,list-single-var)
(marks . ,marks-var))
'guix-list-data ',entry-type)
diff --git a/emacs/guix-ui-package.el b/emacs/guix-ui-package.el
index 299822aae9..66cf0fe6f0 100644
--- a/emacs/guix-ui-package.el
+++ b/emacs/guix-ui-package.el
@@ -57,12 +57,6 @@ package data)."
(const :tag "Display outputs" output))
:group 'guix-package)
-(defcustom guix-package-list-single nil
- "If non-nil, list a package even if it is the only matching result.
-If nil, show a single package in the info buffer."
- :type 'boolean
- :group 'guix)
-
(defun guix-package-get-display (profile search-type &rest search-values)
"Search for packages/outputs and show results.