diff lisp/progmodes/compile.el @ 95777:edc51d72cb17

* window.c (Vwindow_point_insertion_type): New var. (set_window_buffer): Use it. (syms_of_window): Init and export it to Lisp. * progmodes/compile.el (compilation-mode): Set window-point-insertion-type. (compilation-filter): Don't use insert-before-markers any more. * emacs-lisp/trace.el (trace-make-advice): Set window-point-insertion-type in the trace buffer. * startup.el (normal-top-level): Set window-point-insertion-type in *Messages*. * net/telnet.el (telnet-mode): Set window-point-insertion-type. (telnet-filter): Don't use insert-before-markers any more. * comint.el (comint-mode): Set window-point-insertion-type. (comint-output-filter): Don't use insert-before-markers any more. * button.el (make-text-button): Allow `start' to be a string.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 10 Jun 2008 16:08:48 +0000
parents b51bb57e843b
children 6f2d537d8c7a
line wrap: on
line diff
--- a/lisp/progmodes/compile.el	Tue Jun 10 14:17:32 2008 +0000
+++ b/lisp/progmodes/compile.el	Tue Jun 10 16:08:48 2008 +0000
@@ -1467,6 +1467,8 @@
   (interactive)
   (kill-all-local-variables)
   (use-local-map compilation-mode-map)
+  ;; Let windows scroll along with the output.
+  (set (make-local-variable 'window-point-insertion-type) t)
   (set (make-local-variable 'tool-bar-map) compilation-mode-tool-bar-map)
   (setq major-mode 'compilation-mode
 	mode-name (or name-of-mode "Compilation"))
@@ -1663,13 +1665,16 @@
 
 (defun compilation-filter (proc string)
   "Process filter for compilation buffers.
-Just inserts the text, but uses `insert-before-markers'."
-  (if (buffer-name (process-buffer proc))
+Just inserts the text, and runs `compilation-filter-hook'."
+  (if (buffer-live-p (process-buffer proc))
       (with-current-buffer (process-buffer proc)
 	(let ((inhibit-read-only t))
 	  (save-excursion
 	    (goto-char (process-mark proc))
-	    (insert-before-markers string)
+            ;; We used to use `insert-before-markers', so that windows with
+            ;; point at `process-mark' scroll along with the output, but we
+            ;; now use window-point-insertion-type instead.
+	    (insert string)
 	    (run-hooks 'compilation-filter-hook))))))
 
 ;;; test if a buffer is a compilation buffer, assuming we're in the buffer