summary refs log tree commit diff
path: root/emacs/guix-list.el
diff options
context:
space:
mode:
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)