diff options
| author | Alex Kost <alezost@gmail.com> | 2015-05-27 20:33:42 +0300 |
|---|---|---|
| committer | Alex Kost <alezost@gmail.com> | 2015-05-29 20:54:54 +0300 |
| commit | 5a727cdfa983c6fb6ea8bdecd6d298db439e3610 (patch) | |
| tree | 51a898bd23a2eebbc8a086ae8218ea4974458c2a | |
| parent | 578b98da43a946f1db2d3b6dd4585c5c0ad5aa6d (diff) | |
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.
| -rw-r--r-- | doc/emacs.texi | 5 | ||||
| -rw-r--r-- | emacs/guix-base.el | 27 |
2 files changed, 32 insertions, 0 deletions
diff --git a/doc/emacs.texi b/doc/emacs.texi index 9678570d58d..6c1b255af08 100644 --- a/doc/emacs.texi +++ b/doc/emacs.texi | |||
| @@ -183,6 +183,11 @@ packages/generations and redisplay it. | |||
| 183 | @item R | 183 | @item R |
| 184 | Redisplay current buffer (without updating information). | 184 | Redisplay current buffer (without updating information). |
| 185 | 185 | ||
| 186 | @item M | ||
| 187 | Apply manifest to the current profile or to a specified profile, if | ||
| 188 | prefix argument is used. This has the same meaning as @code{--manifest} | ||
| 189 | option (@pxref{Invoking guix package}). | ||
| 190 | |||
| 186 | @item C-c C-z | 191 | @item C-c C-z |
| 187 | Go to the Guix REPL (@pxref{The REPL,,, geiser, Geiser User Manual}). | 192 | Go to the Guix REPL (@pxref{The REPL,,, geiser, Geiser User Manual}). |
| 188 | 193 | ||
diff --git a/emacs/guix-base.el b/emacs/guix-base.el index 5129c87a5df..851ee895b98 100644 --- a/emacs/guix-base.el +++ b/emacs/guix-base.el | |||
| @@ -439,6 +439,7 @@ following keywords are available: | |||
| 439 | (define-key map (kbd "r") 'guix-history-forward) | 439 | (define-key map (kbd "r") 'guix-history-forward) |
| 440 | (define-key map (kbd "g") 'revert-buffer) | 440 | (define-key map (kbd "g") 'revert-buffer) |
| 441 | (define-key map (kbd "R") 'guix-redisplay-buffer) | 441 | (define-key map (kbd "R") 'guix-redisplay-buffer) |
| 442 | (define-key map (kbd "M") 'guix-apply-manifest) | ||
| 442 | (define-key map (kbd "C-c C-z") 'guix-switch-to-repl))))) | 443 | (define-key map (kbd "C-c C-z") 'guix-switch-to-repl))))) |
| 443 | 444 | ||
| 444 | (put 'guix-define-buffer-type 'lisp-indent-function 'defun) | 445 | (put 'guix-define-buffer-type 'lisp-indent-function 'defun) |
| @@ -1022,6 +1023,32 @@ Ask a user with PROMPT for continuing an operation." | |||
| 1022 | :dry-run? (or guix-dry-run 'f)) | 1023 | :dry-run? (or guix-dry-run 'f)) |
| 1023 | nil 'source-download))) | 1024 | nil 'source-download))) |
| 1024 | 1025 | ||
| 1026 | ;;;###autoload | ||
| 1027 | (defun guix-apply-manifest (profile file &optional operation-buffer) | ||
| 1028 | "Apply manifest from FILE to PROFILE. | ||
| 1029 | This function has the same meaning as 'guix package --manifest' command. | ||
| 1030 | See Info node `(guix) Invoking guix package' for details. | ||
| 1031 | |||
| 1032 | Interactively, use the current profile and prompt for manifest | ||
| 1033 | FILE. With a prefix argument, also prompt for PROFILE." | ||
| 1034 | (interactive | ||
| 1035 | (let* ((default-profile (or guix-profile guix-current-profile)) | ||
| 1036 | (profile (if current-prefix-arg | ||
| 1037 | (guix-profile-prompt) | ||
| 1038 | default-profile)) | ||
| 1039 | (file (read-file-name "File with manifest: ")) | ||
| 1040 | (buffer (and guix-profile (current-buffer)))) | ||
| 1041 | (list profile file buffer))) | ||
| 1042 | (when (or (not guix-operation-confirm) | ||
| 1043 | (y-or-n-p (format "Apply manifest from '%s' to profile '%s'? " | ||
| 1044 | file profile))) | ||
| 1045 | (guix-eval-in-repl | ||
| 1046 | (guix-make-guile-expression | ||
| 1047 | 'guix-package | ||
| 1048 | (concat "--profile=" profile) | ||
| 1049 | (concat "--manifest=" file)) | ||
| 1050 | operation-buffer))) | ||
| 1051 | |||
| 1025 | 1052 | ||
| 1026 | ;;; Pull | 1053 | ;;; Pull |
| 1027 | 1054 | ||
