diff lisp/progmodes/compile.el @ 103248:97c6a390ad50

* progmodes/compile.el (compilation-filter): If inserting at end of accessible part of buffer, keep end of output visible.
author Richard M. Stallman <rms@gnu.org>
date Mon, 18 May 2009 16:30:59 +0000
parents 7b826f79f0d7
children 6d3359edbf15
line wrap: on
line diff
--- a/lisp/progmodes/compile.el	Mon May 18 16:26:57 2009 +0000
+++ b/lisp/progmodes/compile.el	Mon May 18 16:30:59 2009 +0000
@@ -1739,9 +1739,15 @@
     (with-current-buffer (process-buffer proc)
       (let ((inhibit-read-only t)
             ;; `save-excursion' doesn't use the right insertion-type for us.
-            (pos (copy-marker (point) t)))
+            (pos (copy-marker (point) t))
+	    (min (point-min-marker))
+	    (max (point-max-marker)))
         (unwind-protect
             (progn
+	      ;; If we are inserting at the end of the accessible part
+	      ;; of the buffer, keep the inserted text visible.
+	      (set-marker-insertion-type max t)
+	      (widen)
               (goto-char (process-mark proc))
               ;; We used to use `insert-before-markers', so that windows with
               ;; point at `process-mark' scroll along with the output, but we
@@ -1751,7 +1757,10 @@
                 (comint-carriage-motion (process-mark proc) (point)))
               (set-marker (process-mark proc) (point))
               (run-hooks 'compilation-filter-hook))
-          (goto-char pos))))))
+	  (goto-char pos)
+          (narrow-to-region min max)
+	  (set-marker min nil)
+	  (set-marker max nil))))))
 
 ;;; test if a buffer is a compilation buffer, assuming we're in the buffer
 (defsubst compilation-buffer-internal-p ()