summary refs log tree commit diff
path: root/emacs/guix-base.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-base.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-base.el')
-rw-r--r--emacs/guix-base.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index aafa220f8b..5131eb0f87 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -816,6 +816,15 @@ Each element from GENERATIONS is a generation number."
      (guix-make-guile-expression
       'delete-generations* guix-current-profile generations))))
 
+(defun guix-switch-to-generation (generation)
+  "Switch `guix-current-profile' to GENERATION number."
+  (when (or (not guix-operation-confirm)
+            (y-or-n-p (format "Switch current profile to generation %d? "
+                              generation)))
+    (guix-eval-in-repl
+     (guix-make-guile-expression
+      'switch-to-generation guix-current-profile generation))))
+
 (provide 'guix-base)
 
 ;;; guix-base.el ends here