[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
15/37: emacs: list: Factorize "edit package" commands.
From: |
Alex Kost |
Subject: |
15/37: emacs: list: Factorize "edit package" commands. |
Date: |
Fri, 18 Dec 2015 18:51:26 +0000 |
alezost pushed a commit to branch wip-refactor-emacs-ui
in repository guix.
commit 46f7a768c841ae2e4ce24ef5e9f2bbfa5f6c0795
Author: Alex Kost <address@hidden>
Date: Thu Nov 19 20:09:16 2015 +0300
emacs: list: Factorize "edit package" commands.
* emacs/guix-list.el: Use separate edit commands instead of a single one.
(guix-list-for-each-line, guix-list-edit-package): Remove.
(guix-package-list-edit, guix-output-list-edit): New procedures.
(guix-package-list-mode-map, guix-output-list-mode-map): Use them.
---
emacs/guix-list.el | 28 +++++++++++++---------------
1 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index bac85be..e1fc199 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -234,14 +234,6 @@ VAL may be nil."
"Return alist of the current entry info."
(guix-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-entry-value (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)
@@ -530,11 +522,6 @@ See also `guix-list-describe'."
(put 'guix-list-define-entry-type 'lisp-indent-function 'defun)
-(defun guix-list-edit-package ()
- "Go to the location of the current package."
- (interactive)
- (guix-edit (guix-list-current-package-id)))
-
;;; Displaying packages
@@ -579,7 +566,7 @@ likely)."
:group 'guix-package-list)
(let ((map guix-package-list-mode-map))
- (define-key map (kbd "e") 'guix-list-edit-package)
+ (define-key map (kbd "e") 'guix-package-list-edit)
(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)
@@ -722,6 +709,11 @@ The specification is suitable for
`guix-process-package-actions'."
(let ((specs (guix-list-get-marked-args action-type)))
(and specs (cons action-type specs))))
+(defun guix-package-list-edit ()
+ "Go to the location of the current package."
+ (interactive)
+ (guix-edit (guix-list-current-id)))
+
;;; Displaying outputs
@@ -742,7 +734,7 @@ The specification is suitable for
`guix-process-package-actions'."
(delete . ?D)))
(let ((map guix-output-list-mode-map))
- (define-key map (kbd "e") 'guix-list-edit-package)
+ (define-key map (kbd "e") 'guix-output-list-edit)
(define-key map (kbd "x") 'guix-output-list-execute)
(define-key map (kbd "i") 'guix-output-list-mark-install)
(define-key map (kbd "d") 'guix-output-list-mark-delete)
@@ -815,6 +807,12 @@ See `guix-package-info-type'."
guix-profile 'info 'package 'id
(cl-remove-duplicates pids)))))
+(defun guix-output-list-edit ()
+ "Go to the location of the current package."
+ (interactive)
+ (guix-edit (guix-entry-value (guix-list-current-entry)
+ 'package-id)))
+
;;; Displaying generations
- 03/37: emacs: Add API for 'guix-entry'., (continued)
- 03/37: emacs: Add API for 'guix-entry'., Alex Kost, 2015/12/18
- 05/37: emacs: list: Generate numerical sort predicates., Alex Kost, 2015/12/18
- 07/37: emacs: list: Configure format in one place., Alex Kost, 2015/12/18
- 09/37: emacs: Add 'guix-alist-put'., Alex Kost, 2015/12/18
- 08/37: emacs: Add 'guix-keyword-args-let'., Alex Kost, 2015/12/18
- 12/37: emacs: list: Generalize 'sort-key' code., Alex Kost, 2015/12/18
- 10/37: emacs: list: Generalize 'marks' code., Alex Kost, 2015/12/18
- 11/37: emacs: list: Generalize 'describe' code., Alex Kost, 2015/12/18
- 13/37: emacs: list: Add 'guix-list-mode-initialize'., Alex Kost, 2015/12/18
- 14/37: emacs: list: Split 'guix-list-format' variable., Alex Kost, 2015/12/18
- 15/37: emacs: list: Factorize "edit package" commands.,
Alex Kost <=
- 06/37: emacs: Rename internal procedures., Alex Kost, 2015/12/18
- 20/37: emacs: Add wrappers for 'history-size' and 'revert-confirm'., Alex Kost, 2015/12/18
- 24/37: emacs: Improve messages for packages found by ID., Alex Kost, 2015/12/18
- 19/37: emacs: Split 'guix-param-titles' variable., Alex Kost, 2015/12/18
- 25/37: emacs: info: Buttonize package name heading., Alex Kost, 2015/12/18
- 21/37: emacs: Split 'guix-root-map' keymap., Alex Kost, 2015/12/18
- 22/37: emacs: Generalize buffer redisplaying., Alex Kost, 2015/12/18
- 18/37: emacs: info: Split 'guix-info-format' variable., Alex Kost, 2015/12/18
- 23/37: emacs: Generalize buffer reverting., Alex Kost, 2015/12/18
- 27/37: emacs: info: Get rid of syntactic fontification., Alex Kost, 2015/12/18