aboutsummaryrefslogtreecommitdiff
path: root/emacs/guix-backend.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2014-10-14 20:43:10 +0400
committerAlex Kost <alezost@gmail.com>2014-10-16 10:09:53 +0400
commit49d758d212d78976d6679125fa1731537c768526 (patch)
tree47f77d6ec5ad784a721b98e855768c0518a567a3 /emacs/guix-backend.el
parent063b60be7b0de45630095cf22f097eaa1953f863 (diff)
downloadpatches-49d758d212d78976d6679125fa1731537c768526.tar
patches-49d758d212d78976d6679125fa1731537c768526.tar.gz
emacs: Support auto-updating after performing REPL operation.
* emacs/guix-backend.el (guix-operation-buffer): New variable. (guix-eval-in-repl): Use it. Add optional 'operation-buffer' argument. * emacs/guix-base.el (guix-update-after-operation): New variable. (guix-switch-to-buffer, guix-list-or-info-buffer-p, guix-buffers, guix-update-buffers-maybe): New procedures. (guix-set-buffer): Use 'guix-switch-to-buffer'. Add optional 'no-display' argument. (guix-process-package-actions, guix-delete-generations, guix-switch-to-generation): Add optional 'operation-buffer' argument. * emacs/guix-info.el (guix-package-info-insert-action-button, guix-generation-info-insert-number, guix-generation-info-insert-current): Adjust for using operation buffer. * emacs/guix-list.el (guix-list-execute-package-actions, guix-generation-list-switch, guix-generation-list-execute): Likewise.
Diffstat (limited to 'emacs/guix-backend.el')
-rw-r--r--emacs/guix-backend.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/emacs/guix-backend.el b/emacs/guix-backend.el
index 0ca9083434..d37d9d4b67 100644
--- a/emacs/guix-backend.el
+++ b/emacs/guix-backend.el
@@ -234,6 +234,7 @@ This is a replacement for `geiser-repl--output-filter'."
(setq guix-repl-operation-p nil)
(run-hooks 'guix-after-repl-operation-hook)))
((string-match geiser-guile--debugger-prompt-regexp str)
+ (setq guix-repl-operation-p nil)
(geiser-con--connection-set-debugging geiser-repl--connection
(match-beginning 0))
(geiser-autodoc--disinhibit-autodoc))))
@@ -272,6 +273,9 @@ additional internal REPL if it exists."
;;; Evaluating expressions
+(defvar guix-operation-buffer nil
+ "Buffer from which the latest Guix operation was performed.")
+
(defun guix-make-guile-expression (fun &rest args)
"Return string containing a guile expression for calling FUN with ARGS."
(format "(%S %s)" fun
@@ -313,10 +317,13 @@ Return elisp expression of the first result value of evaluation."
(replace-regexp-in-string
"#t" "t" (car (guix-eval str wrap))))))
-(defun guix-eval-in-repl (str)
- "Switch to Guix REPL and evaluate STR with guile expression there."
+(defun guix-eval-in-repl (str &optional operation-buffer)
+ "Switch to Guix REPL and evaluate STR with guile expression there.
+If OPERATION-BUFFER is non-nil, it should be a buffer from which
+the current operation was performed."
(run-hooks 'guix-before-repl-operation-hook)
- (setq guix-repl-operation-p t)
+ (setq guix-repl-operation-p t
+ guix-operation-buffer operation-buffer)
(let ((repl (guix-get-repl-buffer)))
(with-current-buffer repl
(delete-region (geiser-repl--last-prompt-end) (point-max))