From 49d758d212d78976d6679125fa1731537c768526 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Tue, 14 Oct 2014 20:43:10 +0400 Subject: 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. --- emacs/guix-backend.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'emacs/guix-backend.el') 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)) -- cgit v1.2.3