diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-01-29 08:18:52 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-01-29 08:18:52 +0100 |
commit | 19afd6de25eb836014301009620091be6f0012b0 (patch) | |
tree | 6fab21eaae69e305faded1921cba70f5f03c07d0 | |
parent | 4e27a260e5886ee9f51877c4e66306e411c195e1 (diff) | |
download | emacs-19afd6de25eb836014301009620091be6f0012b0.tar.gz |
Fix previous commit regarding revert-buffer-function
* simple.el (shell-command, shell-command-on-region): Set
revert-buffer-function buffer-locally, not globally. Also, avoid an
unnecessary call to (current-buffer) by taking advantage of the
closure (bug#46151).
-rw-r--r-- | lisp/simple.el | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 64ee0421356..742fc5004dc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3991,9 +3991,9 @@ impose the use of a shell (with its need to quote arguments)." (start-process-shell-command "Shell" buffer command))) (setq mode-line-process '(":%s")) (shell-mode) - (setq revert-buffer-function - (lambda (&rest _) - (async-shell-command command (current-buffer)))) + (setq-local revert-buffer-function + (lambda (&rest _) + (async-shell-command command buffer))) (set-process-sentinel proc #'shell-command-sentinel) ;; Use the comint filter for proper handling of ;; carriage motion (see comint-inhibit-carriage-motion). @@ -4260,9 +4260,9 @@ characters." buffer)))) ;; Report the output. (with-current-buffer buffer - (setq revert-buffer-function - (lambda (&rest _) - (shell-command command))) + (setq-local revert-buffer-function + (lambda (&rest _) + (shell-command command))) (setq mode-line-process (cond ((null exit-status) " - Error") |