]> git.eshelyaron.com Git - emacs.git/commitdiff
Set revert-buffer-function in shell command output buffers
authorSean Whitton <spwhitton@spwhitton.name>
Fri, 29 Jan 2021 05:50:38 +0000 (06:50 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 29 Jan 2021 06:04:47 +0000 (07:04 +0100)
* simple.el (shell-command, shell-command-on-region): Set
revert-buffer-function in shell command output buffers (bug#46151).

lisp/simple.el

index e82b138b0dad4a295351d6a51f44d025ee651719..64ee04213560272bccb9879e0d33e2903d2b7fea 100644 (file)
@@ -3991,6 +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))))
                   (set-process-sentinel proc #'shell-command-sentinel)
                  ;; Use the comint filter for proper handling of
                  ;; carriage motion (see comint-inhibit-carriage-motion).
@@ -4257,6 +4260,9 @@ characters."
                                              buffer))))
             ;; Report the output.
             (with-current-buffer buffer
+              (setq revert-buffer-function
+                    (lambda (&rest _)
+                      (shell-command command)))
               (setq mode-line-process
                     (cond ((null exit-status)
                            " - Error")