summary refs log tree commit diff
path: root/emacs/guix-list.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2014-10-10 23:58:30 +0400
committerAlex Kost <alezost@gmail.com>2014-10-13 14:59:35 +0400
commitaf874238d4d05f6584eebb7ceee10ee2ab1bf312 (patch)
tree04b57bb0766ac8e800b382c02099ba4681f981cc /emacs/guix-list.el
parentc2379b3c1fe169b56d7d960fa31b1d191a779b1b (diff)
downloadguix-af874238d4d05f6584eebb7ceee10ee2ab1bf312.tar.gz
emacs: Add support for switching generations.
* emacs/guix-base.el (guix-switch-to-generation): New procedure.
* emacs/guix-info.el (guix-generation-info-insert-current): Insert button for
  switching to generation.
* emacs/guix-list.el (guix-generation-list-switch): New procedure.
* doc/emacs.texi (emacs List buffer, emacs Info buffer): Document switching
  generations.
Diffstat (limited to 'emacs/guix-list.el')
-rw-r--r--emacs/guix-list.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index f9d106b421..c3e8ef4cdc 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -735,6 +735,7 @@ Also see `guix-package-info-type'."
   (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 "s")   'guix-generation-list-switch)
   (define-key map (kbd "d")   'guix-generation-list-mark-delete))
 
 (defun guix-generation-list-get-current (val &optional _)
@@ -742,6 +743,16 @@ Also see `guix-package-info-type'."
 VAL is a boolean value."
   (if val "(current)" ""))
 
+(defun guix-generation-list-switch ()
+  "Switch current profile to the generation at point."
+  (interactive)
+  (let* ((entry   (guix-list-current-entry))
+         (current (guix-get-key-val entry 'current))
+         (number  (guix-get-key-val entry 'number)))
+    (if current
+        (user-error "This generation is already the current one")
+      (guix-switch-to-generation number))))
+
 (defun guix-generation-list-show-packages ()
   "List installed packages for the generation at point."
   (interactive)