From: Lars Ingebrigtsen Date: Fri, 23 Aug 2019 08:10:09 +0000 (+0200) Subject: Put error output from M-! at the end of the error buffer X-Git-Tag: emacs-27.0.90~1328^2~107 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=27988f136c35396e0ef1e865f5a0c0a0bf20358a;p=emacs.git Put error output from M-! at the end of the error buffer * 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. --- diff --git a/lisp/simple.el b/lisp/simple.el index 9f86d70f847..358b6a4f200 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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))