emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/compile.el, v [EMACS_22_BA


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/compile.el, v [EMACS_22_BASE]
Date: Thu, 27 Dec 2007 03:31:13 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         EMACS_22_BASE
Changes by:     Richard M. Stallman <rms>       07/12/27 03:31:13

Index: compile.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/compile.el,v
retrieving revision 1.421.2.10
retrieving revision 1.421.2.11
diff -u -b -r1.421.2.10 -r1.421.2.11
--- compile.el  20 Sep 2007 18:56:18 -0000      1.421.2.10
+++ compile.el  27 Dec 2007 03:31:13 -0000      1.421.2.11
@@ -1055,10 +1055,6 @@
                command "\n")
        (setq thisdir default-directory))
       (set-buffer-modified-p nil))
-    ;; If we're already in the compilation buffer, go to the end
-    ;; of the buffer, so point will track the compilation output.
-    (if (eq outbuf (current-buffer))
-       (goto-char (point-max)))
     ;; Pop up the compilation buffer.
     (setq outwin (display-buffer outbuf nil t))
     (with-current-buffer outbuf
@@ -1083,10 +1079,18 @@
        (set (make-local-variable 'revert-buffer-function)
             'compilation-revert-buffer)
        (set-window-start outwin (point-min))
-       (or (eq outwin (selected-window))
-           (set-window-point outwin (if compilation-scroll-output
-                                        (point)
+
+       ;; Position point as the user will see it.
+       (let ((desired-visible-point
+              ;; Put it at the end if `compilation-scroll-output' is set.
+              (if compilation-scroll-output
+                  (point-max)
+                ;; Normally put it at the top.
                                       (point-min))))
+         (if (eq outwin (selected-window))
+             (goto-char desired-visible-point)
+           (set-window-point outwin desired-visible-point)))
+
        ;; The setup function is called before compilation-set-window-height
        ;; so it can set the compilation-window-height buffer locally.
        (if compilation-process-setup-function
@@ -1105,7 +1109,10 @@
              (setq mode-line-process '(":%s"))
              (set-process-sentinel proc 'compilation-sentinel)
              (set-process-filter proc 'compilation-filter)
-             (set-marker (process-mark proc) (point) outbuf)
+             ;; Use (point-max) here so that output comes in
+             ;; after the initial text,
+             ;; regardless of where the user sees point.
+             (set-marker (process-mark proc) (point-max) outbuf)
              (when compilation-disable-input
                 (condition-case nil
                     (process-send-eof proc)
@@ -1119,6 +1126,10 @@
          (setq mode-line-process ":run")
          (force-mode-line-update)
          (sit-for 0)                   ; Force redisplay
+         (save-excursion
+           ;; Insert the output at the end, after the initial text,
+           ;; regardless of where the user sees point.
+           (goto-char (point-max))
          (let* ((buffer-read-only nil) ; call-process needs to modify outbuf
                 (status (call-process shell-file-name nil outbuf nil "-c"
                                       command)))
@@ -1133,7 +1144,7 @@
                   (compilation-handle-exit 'signal status
                                            (concat status "\n")))
                  (t
-                  (compilation-handle-exit 'bizarre status status))))
+                    (compilation-handle-exit 'bizarre status status)))))
          ;; Without async subprocesses, the buffer is not yet
          ;; fontified, so fontify it now.
          (let ((font-lock-verbose nil)) ; shut up font-lock messages




reply via email to

[Prev in Thread] Current Thread [Next in Thread]