summaryrefslogtreecommitdiff
path: root/emacs/guix-list.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2014-10-05 12:31:23 +0400
committerAlex Kost <alezost@gmail.com>2014-10-06 00:02:46 +0400
commitcb6a5c71d875fff6f1c3b2bd1e43c31cc7cfe1ac (patch)
tree8413cb2e9398785ea4e886ac087bc8bb80ca1c03 /emacs/guix-list.el
parentd3d337d2d8f7152cb9ff3724f1cf240ce5ea5be2 (diff)
downloadpatches-cb6a5c71d875fff6f1c3b2bd1e43c31cc7cfe1ac.tar
patches-cb6a5c71d875fff6f1c3b2bd1e43c31cc7cfe1ac.tar.gz
emacs: Add support for deleting generations.
* doc/emacs.texi (emacs List buffer): Mention new key bindings. * emacs/guix-base.el (guix-delete-generations): New procedure. * emacs/guix-info.el (guix-generation-info-insert-number): Use it. * emacs/guix-list.el (guix-generation-list-mark-delete, guix-generation-list-execute): New procedures. * emacs/guix-main.scm (delete-generations*): New procedure.
Diffstat (limited to 'emacs/guix-list.el')
-rw-r--r--emacs/guix-list.el19
1 files changed, 18 insertions, 1 deletions
diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index 6a4cdfc552..4b4b9c5396 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -728,8 +728,9 @@ Also see `guix-package-info-type'."
(let ((map guix-generation-list-mode-map))
(define-key map (kbd "RET") 'guix-generation-list-show-packages)
+ (define-key map (kbd "x") 'guix-generation-list-execute)
(define-key map (kbd "i") 'guix-list-describe)
- (define-key map (kbd "d") 'guix-generation-list-mark-delete-simple))
+ (define-key map (kbd "d") 'guix-generation-list-mark-delete))
(defun guix-generation-list-show-packages ()
"List installed packages for the generation at point."
@@ -737,6 +738,22 @@ Also see `guix-package-info-type'."
(guix-get-show-entries 'list guix-package-list-type 'generation
(guix-list-current-id)))
+(defun guix-generation-list-mark-delete (&optional arg)
+ "Mark the current generation for deletion and move to the next line.
+With ARG, mark all generations for deletion."
+ (interactive "P")
+ (if arg
+ (guix-list-mark-all 'delete)
+ (guix-list-mark 'delete t)))
+
+(defun guix-generation-list-execute ()
+ "Delete marked generations."
+ (interactive)
+ (let ((marked (guix-list-get-marked-id-list 'delete)))
+ (or marked
+ (user-error "No generations marked for deletion"))
+ (apply #'guix-delete-generations marked)))
+
(provide 'guix-list)
;;; guix-list.el ends here