aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-05-27 20:33:42 +0300
committerAlex Kost <alezost@gmail.com>2015-05-29 20:54:54 +0300
commit5a727cdfa983c6fb6ea8bdecd6d298db439e3610 (patch)
tree51a898bd23a2eebbc8a086ae8218ea4974458c2a /emacs
parent578b98da43a946f1db2d3b6dd4585c5c0ad5aa6d (diff)
downloadguix-5a727cdfa983c6fb6ea8bdecd6d298db439e3610.tar
guix-5a727cdfa983c6fb6ea8bdecd6d298db439e3610.tar.gz
emacs: Add 'guix-apply-manifest'.
* emacs/guix-base.el (guix-apply-manifest): New command. Bind it to "M" key. * doc/emacs.texi (Emacs General info): Document it.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/guix-base.el27
1 files changed, 27 insertions, 0 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 5129c87a5d..851ee895b9 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -439,6 +439,7 @@ following keywords are available:
(define-key map (kbd "r") 'guix-history-forward)
(define-key map (kbd "g") 'revert-buffer)
(define-key map (kbd "R") 'guix-redisplay-buffer)
+ (define-key map (kbd "M") 'guix-apply-manifest)
(define-key map (kbd "C-c C-z") 'guix-switch-to-repl)))))
(put 'guix-define-buffer-type 'lisp-indent-function 'defun)
@@ -1022,6 +1023,32 @@ Ask a user with PROMPT for continuing an operation."
:dry-run? (or guix-dry-run 'f))
nil 'source-download)))
+;;;###autoload
+(defun guix-apply-manifest (profile file &optional operation-buffer)
+ "Apply manifest from FILE to PROFILE.
+This function has the same meaning as 'guix package --manifest' command.
+See Info node `(guix) Invoking guix package' for details.
+
+Interactively, use the current profile and prompt for manifest
+FILE. With a prefix argument, also prompt for PROFILE."
+ (interactive
+ (let* ((default-profile (or guix-profile guix-current-profile))
+ (profile (if current-prefix-arg
+ (guix-profile-prompt)
+ default-profile))
+ (file (read-file-name "File with manifest: "))
+ (buffer (and guix-profile (current-buffer))))
+ (list profile file buffer)))
+ (when (or (not guix-operation-confirm)
+ (y-or-n-p (format "Apply manifest from '%s' to profile '%s'? "
+ file profile)))
+ (guix-eval-in-repl
+ (guix-make-guile-expression
+ 'guix-package
+ (concat "--profile=" profile)
+ (concat "--manifest=" file))
+ operation-buffer)))
+
;;; Pull