aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-06-19 21:47:31 +0300
committerAlex Kost <alezost@gmail.com>2015-06-22 22:19:19 +0300
commit6a8c9545cb9702236586d905b9ebbf2790fcdf91 (patch)
tree9a876af5ce7c6668b4562f1a0393b7d58be080af
parent8c2dbe3f9d01e51666da1f4108114706780a1f21 (diff)
downloadpatches-6a8c9545cb9702236586d905b9ebbf2790fcdf91.tar
patches-6a8c9545cb9702236586d905b9ebbf2790fcdf91.tar.gz
emacs: Simplify defining package ID in a list buffer.
* emacs/guix-list.el: Always retrieve 'package-id' parameter for a list of outputs. (guix-list-current-package-id): New function.
-rw-r--r--emacs/guix-list.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index 279de818c6..130b240c1e 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -215,6 +215,14 @@ VAL may be nil."
"Return alist of the current entry info."
(guix-get-entry-by-id (guix-list-current-id) guix-entries))
+(defun guix-list-current-package-id ()
+ "Return ID of the current package."
+ (cl-ecase major-mode
+ (guix-package-list-mode
+ (guix-list-current-id))
+ (guix-output-list-mode
+ (guix-get-key-val (guix-list-current-entry) 'package-id))))
+
(defun guix-list-for-each-line (fun &rest args)
"Call FUN with ARGS for each entry line."
(or (derived-mode-p 'guix-list-mode)
@@ -643,7 +651,8 @@ The specification is suitable for `guix-process-package-actions'."
;;; Displaying outputs
(guix-define-buffer-type list output
- :buffer-name "*Guix Package List*")
+ :buffer-name "*Guix Package List*"
+ :required (package-id))
(guix-list-define-entry-type output
:sort-key name