comparison lisp/progmodes/compile.el @ 91302:56a72e2bd635

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-306
author Miles Bader <miles@gnu.org>
date Sat, 29 Dec 2007 02:39:17 +0000
parents 53108e6cea98 cdd30283527d
children 606f2d163a64
comparison
equal deleted inserted replaced
91301:7774e5860c70 91302:56a72e2bd635
1161 mode-name 1161 mode-name
1162 (substring (current-time-string) 0 19)) 1162 (substring (current-time-string) 0 19))
1163 command "\n") 1163 command "\n")
1164 (setq thisdir default-directory)) 1164 (setq thisdir default-directory))
1165 (set-buffer-modified-p nil)) 1165 (set-buffer-modified-p nil))
1166 ;; If we're already in the compilation buffer, go to the end
1167 ;; of the buffer, so point will track the compilation output.
1168 (if (eq outbuf (current-buffer))
1169 (goto-char (point-max)))
1170 ;; Pop up the compilation buffer. 1166 ;; Pop up the compilation buffer.
1171 (setq outwin (display-buffer outbuf nil t)) 1167 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01638.html
1168 (setq outwin (display-buffer outbuf))
1172 (with-current-buffer outbuf 1169 (with-current-buffer outbuf
1173 (let ((process-environment 1170 (let ((process-environment
1174 (append 1171 (append
1175 compilation-environment 1172 compilation-environment
1176 (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning 1173 (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning
1189 (set (make-local-variable 'compilation-arguments) 1186 (set (make-local-variable 'compilation-arguments)
1190 (list command mode name-function highlight-regexp)) 1187 (list command mode name-function highlight-regexp))
1191 (set (make-local-variable 'revert-buffer-function) 1188 (set (make-local-variable 'revert-buffer-function)
1192 'compilation-revert-buffer) 1189 'compilation-revert-buffer)
1193 (set-window-start outwin (point-min)) 1190 (set-window-start outwin (point-min))
1194 (or (eq outwin (selected-window)) 1191
1195 (set-window-point outwin (if compilation-scroll-output 1192 ;; Position point as the user will see it.
1196 (point) 1193 (let ((desired-visible-point
1197 (point-min)))) 1194 ;; Put it at the end if `compilation-scroll-output' is set.
1195 (if compilation-scroll-output
1196 (point-max)
1197 ;; Normally put it at the top.
1198 (point-min))))
1199 (if (eq outwin (selected-window))
1200 (goto-char desired-visible-point)
1201 (set-window-point outwin desired-visible-point)))
1202
1198 ;; The setup function is called before compilation-set-window-height 1203 ;; The setup function is called before compilation-set-window-height
1199 ;; so it can set the compilation-window-height buffer locally. 1204 ;; so it can set the compilation-window-height buffer locally.
1200 (if compilation-process-setup-function 1205 (if compilation-process-setup-function
1201 (funcall compilation-process-setup-function)) 1206 (funcall compilation-process-setup-function))
1202 (compilation-set-window-height outwin) 1207 (compilation-set-window-height outwin)
1216 outbuf command)))) 1221 outbuf command))))
1217 ;; Make the buffer's mode line show process state. 1222 ;; Make the buffer's mode line show process state.
1218 (setq mode-line-process '(":%s")) 1223 (setq mode-line-process '(":%s"))
1219 (set-process-sentinel proc 'compilation-sentinel) 1224 (set-process-sentinel proc 'compilation-sentinel)
1220 (set-process-filter proc 'compilation-filter) 1225 (set-process-filter proc 'compilation-filter)
1221 (set-marker (process-mark proc) (point) outbuf) 1226 ;; Use (point-max) here so that output comes in
1227 ;; after the initial text,
1228 ;; regardless of where the user sees point.
1229 (set-marker (process-mark proc) (point-max) outbuf)
1222 (when compilation-disable-input 1230 (when compilation-disable-input
1223 (condition-case nil 1231 (condition-case nil
1224 (process-send-eof proc) 1232 (process-send-eof proc)
1225 ;; The process may have exited already. 1233 ;; The process may have exited already.
1226 (error nil))) 1234 (error nil)))