diff options
author | Alex Kost <alezost@gmail.com> | 2014-09-17 17:52:08 +0400 |
---|---|---|
committer | Alex Kost <alezost@gmail.com> | 2014-09-24 16:09:20 +0400 |
commit | dfeb023927799b45616b435d27001b0fbd533c2b (patch) | |
tree | b61ca30271705b6555b054126431c6fbb4725a40 /emacs/guix-list.el | |
parent | 8689901f95499e98e0209e75b4f268bf2af325c1 (diff) | |
download | patches-dfeb023927799b45616b435d27001b0fbd533c2b.tar patches-dfeb023927799b45616b435d27001b0fbd533c2b.tar.gz |
emacs: Use general functions instead of generated ones.
* emacs/guix-base.el: Add and use general functions instead of
specialized functions generated by 'guix-define-buffer-type' macro.
(guix-buffer-type, guix-entry-type): New variables.
(guix-set-vars): Add new variables.
(guix-get-show-entries, guix-show-entries, guix-set-buffer)
(guix-history-call, guix-make-history-item)
(guix-get-params-for-receiving, guix-revert-buffer)
(guix-redisplay-buffer): New functions.
(guix-define-buffer-type): Do not generate specialized functions.
* emacs/guix-info.el (guix-package-info-insert-full-names): Use
'guix-get-show-entries'.
(guix-generation-info-insert-number): Likewise.
* emacs/guix-list.el (guix-list-describe): New function.
(guix-list-define-entry-type): Do not generate specialized one.
(guix-generation-list-show-packages): Use 'guix-get-show-entries'.
* emacs/guix.el (guix-show-generations-function): Remove.
(guix-get-show-packages): Use new functions.
(guix-get-show-generations): Likewise.
Diffstat (limited to 'emacs/guix-list.el')
-rw-r--r-- | emacs/guix-list.el | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/emacs/guix-list.el b/emacs/guix-list.el index 8d9b231dd1..3732d9b627 100644 --- a/emacs/guix-list.el +++ b/emacs/guix-list.el @@ -343,6 +343,7 @@ Same as `tabulated-list-sort', but also restore marks after sorting." (defvar guix-list-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map tabulated-list-mode-map) + (define-key map (kbd "RET") 'guix-list-describe) (define-key map (kbd "m") 'guix-list-mark) (define-key map (kbd "*") 'guix-list-mark) (define-key map (kbd "M") 'guix-list-mark-all) @@ -371,16 +372,12 @@ following keywords are available: This macro defines the following functions: - - `guix-ENTRY-TYPE-describe' - display marked entries in info buffer. - - `guix-ENTRY-TYPE-mark-MARK-NAME' functions for each mark specified in `:marks' argument." (let* ((entry-type-str (symbol-name entry-type)) - (entry-str (concat entry-type-str " entries")) (prefix (concat "guix-" entry-type-str "-list")) (mode-str (concat prefix "-mode")) (init-fun (intern (concat prefix "-mode-initialize"))) - (describe-fun (intern (concat prefix "-describe"))) (marks-var (intern (concat prefix "-mark-alist"))) (marks-val nil) (sort-key nil) @@ -409,22 +406,6 @@ This macro defines the following functions: (guix-list-mark ',mark-name t)))) marks-val) - (defun ,describe-fun (&optional arg) - ,(concat "Describe " entry-str " marked with a general mark.\n" - "If no entry is marked, describe the current " entry-type-str ".\n" - "With prefix (if ARG is non-nil), describe the " entry-str "\n" - "marked with any mark.") - (interactive "P") - (let* ((ids (or (apply #'guix-list-get-marked-id-list - (unless arg '(general))) - (list (guix-list-current-id)))) - (count (length ids))) - (when (or (<= count guix-list-describe-warning-count) - (y-or-n-p (format "Do you really want to describe %d entries? " - count))) - (,(intern (concat "guix-" entry-type-str "-info-get-show")) - 'id ids)))) - (defun ,init-fun () ,(concat "Initial settings for `" mode-str "'.") ,(when sort-key @@ -439,6 +420,21 @@ This macro defines the following functions: (put 'guix-list-define-entry-type 'lisp-indent-function 'defun) +(defun guix-list-describe (&optional arg) + "Describe entries marked with a general mark. +If no entries are marked, describe the current entry. +With prefix (if ARG is non-nil), describe entries marked with any mark." + (interactive "P") + (let* ((ids (or (apply #'guix-list-get-marked-id-list + (unless arg '(general))) + (list (guix-list-current-id)))) + (count (length ids))) + (when (or (<= count guix-list-describe-warning-count) + (y-or-n-p (format "Do you really want to describe %d entries? " + count))) + (apply #'guix-get-show-entries + 'info guix-entry-type 'id ids)))) + ;;; Displaying packages @@ -477,7 +473,6 @@ likely)." :group 'guix-package-list) (let ((map guix-package-list-mode-map)) - (define-key map (kbd "RET") 'guix-package-list-describe) (define-key map (kbd "x") 'guix-package-list-execute) (define-key map (kbd "i") 'guix-package-list-mark-install) (define-key map (kbd "d") 'guix-package-list-mark-delete) @@ -617,13 +612,14 @@ The specification is suitable for `guix-process-package-actions'." (let ((map guix-generation-list-mode-map)) (define-key map (kbd "RET") 'guix-generation-list-show-packages) - (define-key map (kbd "i") 'guix-generation-list-describe) + (define-key map (kbd "i") 'guix-list-describe) (define-key map (kbd "d") 'guix-generation-list-mark-delete-simple)) (defun guix-generation-list-show-packages () "List installed packages for the generation at point." (interactive) - (guix-package-list-get-show 'generation (guix-list-current-id))) + (guix-get-show-entries 'list 'package 'generation + (guix-list-current-id))) (provide 'guix-list) |