]> git.eshelyaron.com Git - emacs.git/commitdiff
Put error output from M-! at the end of the error buffer
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 23 Aug 2019 08:10:09 +0000 (10:10 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 23 Aug 2019 08:10:15 +0000 (10:10 +0200)
* lisp/simple.el (shell-command-on-region): Put the error output
at the end of the buffer instead of wherever point is (bug#7513).
This avoids interleaving error output.

lisp/simple.el

index 9f86d70f8471349757c89ad2ba42198111deb5af..358b6a4f2006bcbdab1ae2fea402d2a6d9f9c651 100644 (file)
@@ -3944,15 +3944,14 @@ interactively, this is t."
     (when (and error-file (file-exists-p error-file))
       (if (< 0 (file-attribute-size (file-attributes error-file)))
          (with-current-buffer (get-buffer-create error-buffer)
-           (let ((pos-from-end (- (point-max) (point))))
-             (or (bobp)
-                 (insert "\f\n"))
-             ;; Do no formatting while reading error file,
-             ;; because that can run a shell command, and we
-             ;; don't want that to cause an infinite recursion.
-             (format-insert-file error-file nil)
-             ;; Put point after the inserted errors.
-             (goto-char (- (point-max) pos-from-end)))
+            (goto-char (point-max))
+            ;; Insert a separator if there's already text here.
+           (unless (bobp)
+             (insert "\f\n"))
+           ;; Do no formatting while reading error file,
+           ;; because that can run a shell command, and we
+           ;; don't want that to cause an infinite recursion.
+           (format-insert-file error-file nil)
            (and display-error-buffer
                 (display-buffer (current-buffer)))))
       (delete-file error-file))