diff options
| author | Richard M. Stallman | 2007-12-27 03:31:20 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2007-12-27 03:31:20 +0000 |
| commit | 2d0a22f8260605bab25db423b0acc929bb48dce5 (patch) | |
| tree | f8775bf4210972031f08490bc492221ca56c9f0f | |
| parent | 9f9695a64085d0425c860215dee2de4579ac6d22 (diff) | |
| download | emacs-2d0a22f8260605bab25db423b0acc929bb48dce5.tar.gz emacs-2d0a22f8260605bab25db423b0acc929bb48dce5.zip | |
(compilation-start): Set initial visible point properly even when
compilation buffer already current.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 57 |
2 files changed, 39 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7eb76ce1539..22bb4198dc7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-12-27 Richard Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * progmodes/compile.el (compilation-start): Set initial visible | ||
| 4 | point properly even when compilation buffer already current. | ||
| 5 | |||
| 1 | 2007-12-26 Richard Stallman <rms@gnu.org> | 6 | 2007-12-26 Richard Stallman <rms@gnu.org> |
| 2 | 7 | ||
| 3 | * files.el (conf-mode-maybe): New function. | 8 | * files.el (conf-mode-maybe): New function. |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index a978415d59e..8d2f3a02c00 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -1055,10 +1055,6 @@ Returns the compilation buffer created." | |||
| 1055 | command "\n") | 1055 | command "\n") |
| 1056 | (setq thisdir default-directory)) | 1056 | (setq thisdir default-directory)) |
| 1057 | (set-buffer-modified-p nil)) | 1057 | (set-buffer-modified-p nil)) |
| 1058 | ;; If we're already in the compilation buffer, go to the end | ||
| 1059 | ;; of the buffer, so point will track the compilation output. | ||
| 1060 | (if (eq outbuf (current-buffer)) | ||
| 1061 | (goto-char (point-max))) | ||
| 1062 | ;; Pop up the compilation buffer. | 1058 | ;; Pop up the compilation buffer. |
| 1063 | (setq outwin (display-buffer outbuf nil t)) | 1059 | (setq outwin (display-buffer outbuf nil t)) |
| 1064 | (with-current-buffer outbuf | 1060 | (with-current-buffer outbuf |
| @@ -1083,10 +1079,18 @@ Returns the compilation buffer created." | |||
| 1083 | (set (make-local-variable 'revert-buffer-function) | 1079 | (set (make-local-variable 'revert-buffer-function) |
| 1084 | 'compilation-revert-buffer) | 1080 | 'compilation-revert-buffer) |
| 1085 | (set-window-start outwin (point-min)) | 1081 | (set-window-start outwin (point-min)) |
| 1086 | (or (eq outwin (selected-window)) | 1082 | |
| 1087 | (set-window-point outwin (if compilation-scroll-output | 1083 | ;; Position point as the user will see it. |
| 1088 | (point) | 1084 | (let ((desired-visible-point |
| 1089 | (point-min)))) | 1085 | ;; Put it at the end if `compilation-scroll-output' is set. |
| 1086 | (if compilation-scroll-output | ||
| 1087 | (point-max) | ||
| 1088 | ;; Normally put it at the top. | ||
| 1089 | (point-min)))) | ||
| 1090 | (if (eq outwin (selected-window)) | ||
| 1091 | (goto-char desired-visible-point) | ||
| 1092 | (set-window-point outwin desired-visible-point))) | ||
| 1093 | |||
| 1090 | ;; The setup function is called before compilation-set-window-height | 1094 | ;; The setup function is called before compilation-set-window-height |
| 1091 | ;; so it can set the compilation-window-height buffer locally. | 1095 | ;; so it can set the compilation-window-height buffer locally. |
| 1092 | (if compilation-process-setup-function | 1096 | (if compilation-process-setup-function |
| @@ -1105,7 +1109,10 @@ Returns the compilation buffer created." | |||
| 1105 | (setq mode-line-process '(":%s")) | 1109 | (setq mode-line-process '(":%s")) |
| 1106 | (set-process-sentinel proc 'compilation-sentinel) | 1110 | (set-process-sentinel proc 'compilation-sentinel) |
| 1107 | (set-process-filter proc 'compilation-filter) | 1111 | (set-process-filter proc 'compilation-filter) |
| 1108 | (set-marker (process-mark proc) (point) outbuf) | 1112 | ;; Use (point-max) here so that output comes in |
| 1113 | ;; after the initial text, | ||
| 1114 | ;; regardless of where the user sees point. | ||
| 1115 | (set-marker (process-mark proc) (point-max) outbuf) | ||
| 1109 | (when compilation-disable-input | 1116 | (when compilation-disable-input |
| 1110 | (condition-case nil | 1117 | (condition-case nil |
| 1111 | (process-send-eof proc) | 1118 | (process-send-eof proc) |
| @@ -1119,21 +1126,25 @@ Returns the compilation buffer created." | |||
| 1119 | (setq mode-line-process ":run") | 1126 | (setq mode-line-process ":run") |
| 1120 | (force-mode-line-update) | 1127 | (force-mode-line-update) |
| 1121 | (sit-for 0) ; Force redisplay | 1128 | (sit-for 0) ; Force redisplay |
| 1122 | (let* ((buffer-read-only nil) ; call-process needs to modify outbuf | 1129 | (save-excursion |
| 1123 | (status (call-process shell-file-name nil outbuf nil "-c" | 1130 | ;; Insert the output at the end, after the initial text, |
| 1124 | command))) | 1131 | ;; regardless of where the user sees point. |
| 1125 | (cond ((numberp status) | 1132 | (goto-char (point-max)) |
| 1126 | (compilation-handle-exit 'exit status | 1133 | (let* ((buffer-read-only nil) ; call-process needs to modify outbuf |
| 1127 | (if (zerop status) | 1134 | (status (call-process shell-file-name nil outbuf nil "-c" |
| 1128 | "finished\n" | 1135 | command))) |
| 1129 | (format "\ | 1136 | (cond ((numberp status) |
| 1137 | (compilation-handle-exit 'exit status | ||
| 1138 | (if (zerop status) | ||
| 1139 | "finished\n" | ||
| 1140 | (format "\ | ||
| 1130 | exited abnormally with code %d\n" | 1141 | exited abnormally with code %d\n" |
| 1131 | status)))) | 1142 | status)))) |
| 1132 | ((stringp status) | 1143 | ((stringp status) |
| 1133 | (compilation-handle-exit 'signal status | 1144 | (compilation-handle-exit 'signal status |
| 1134 | (concat status "\n"))) | 1145 | (concat status "\n"))) |
| 1135 | (t | 1146 | (t |
| 1136 | (compilation-handle-exit 'bizarre status status)))) | 1147 | (compilation-handle-exit 'bizarre status status))))) |
| 1137 | ;; Without async subprocesses, the buffer is not yet | 1148 | ;; Without async subprocesses, the buffer is not yet |
| 1138 | ;; fontified, so fontify it now. | 1149 | ;; fontified, so fontify it now. |
| 1139 | (let ((font-lock-verbose nil)) ; shut up font-lock messages | 1150 | (let ((font-lock-verbose nil)) ; shut up font-lock messages |