Commit 27988f13 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

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.
parent ef49439f
Pipeline #2953 failed with stage
in 7 minutes and 53 seconds
...@@ -3944,15 +3944,14 @@ interactively, this is t." ...@@ -3944,15 +3944,14 @@ interactively, this is t."
(when (and error-file (file-exists-p error-file)) (when (and error-file (file-exists-p error-file))
(if (< 0 (file-attribute-size (file-attributes error-file))) (if (< 0 (file-attribute-size (file-attributes error-file)))
(with-current-buffer (get-buffer-create error-buffer) (with-current-buffer (get-buffer-create error-buffer)
(let ((pos-from-end (- (point-max) (point)))) (goto-char (point-max))
(or (bobp) ;; Insert a separator if there's already text here.
(insert "\f\n")) (unless (bobp)
;; Do no formatting while reading error file, (insert "\f\n"))
;; because that can run a shell command, and we ;; Do no formatting while reading error file,
;; don't want that to cause an infinite recursion. ;; because that can run a shell command, and we
(format-insert-file error-file nil) ;; don't want that to cause an infinite recursion.
;; Put point after the inserted errors. (format-insert-file error-file nil)
(goto-char (- (point-max) pos-from-end)))
(and display-error-buffer (and display-error-buffer
(display-buffer (current-buffer))))) (display-buffer (current-buffer)))))
(delete-file error-file)) (delete-file error-file))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment