summaryrefslogtreecommitdiff
path: root/lisp/progmodes/compile.el
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2004-05-07 14:20:00 +0000
committerKaroly Lorentey <lorentey@elte.hu>2004-05-07 14:20:00 +0000
commit52f9ab73a16c71ffe7f8a1c25f9432bbe32f10cf (patch)
tree399c54ddfa7cac6c90a07a81308bf7f5e71b66bd /lisp/progmodes/compile.el
parentb160ff41a813213adfa745a9d009ab638a22d7b1 (diff)
parenta478f3e181bd9925ecb506abf4e49216d392124a (diff)
downloademacs-52f9ab73a16c71ffe7f8a1c25f9432bbe32f10cf.tar.gz
emacs-52f9ab73a16c71ffe7f8a1c25f9432bbe32f10cf.tar.bz2
emacs-52f9ab73a16c71ffe7f8a1c25f9432bbe32f10cf.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-268 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-269 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-270 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-271 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-272 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-273 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-274 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-275 Update from CVS: man/makefile.w32-in: Revert last change * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-276 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-277 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-278 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-279 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-280 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-281 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-282 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-283 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-284 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-285 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-286 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-157
Diffstat (limited to 'lisp/progmodes/compile.el')
-rw-r--r--lisp/progmodes/compile.el51
1 files changed, 41 insertions, 10 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 4c6f88813c0..ec381ad8a15 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -944,6 +944,7 @@ Returns the compilation buffer created."
;; Fake modeline display as if `start-process' were run.
(setq mode-line-process ":run")
(force-mode-line-update)
+ (sit-for 0) ; Force redisplay
(let ((status (call-process shell-file-name nil outbuf nil "-c"
command)))
(cond ((numberp status)
@@ -958,6 +959,10 @@ exited abnormally with code %d\n"
(concat status "\n")))
(t
(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
+ (font-lock-fontify-buffer))
(message "Executing `%s'...done" command)))
(if (buffer-local-value 'compilation-scroll-output outbuf)
(save-selected-window
@@ -1095,10 +1100,6 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)."
(set (make-local-variable 'page-delimiter)
compilation-page-delimiter)
(compilation-setup)
- ;; note that compilation-next-error-function is for interfacing
- ;; with the next-error function in simple.el, and it's only
- ;; coincidentally named similarly to compilation-next-error
- (setq next-error-function 'compilation-next-error-function)
(run-mode-hooks 'compilation-mode-hook))
(defmacro define-compilation-mode (mode name doc &rest body)
@@ -1150,6 +1151,10 @@ variable exists."
"Marker to the location from where the next error will be found.
The global commands next/previous/first-error/goto-error use this.")
+(defvar compilation-messages-start nil
+ "Buffer position of the beginning of the compilation messages.
+If nil, use the beginning of buffer.")
+
;; A function name can't be a hook, must be something with a value.
(defconst compilation-turn-on-font-lock 'turn-on-font-lock)
@@ -1158,8 +1163,13 @@ The global commands next/previous/first-error/goto-error use this.")
Optional argument MINOR indicates this is called from
`compilation-minor-mode'."
(make-local-variable 'compilation-current-error)
+ (make-local-variable 'compilation-messages-start)
(make-local-variable 'compilation-error-screen-columns)
(make-local-variable 'overlay-arrow-position)
+ ;; Note that compilation-next-error-function is for interfacing
+ ;; with the next-error function in simple.el, and it's only
+ ;; coincidentally named similarly to compilation-next-error.
+ (setq next-error-function 'compilation-next-error-function)
(set (make-local-variable 'font-lock-extra-managed-props)
'(directory message help-echo mouse-face debug))
(set (make-local-variable 'compilation-locs)
@@ -1404,16 +1414,16 @@ Use this command in a compilation log buffer. Sets the mark at point there."
(let* ((columns compilation-error-screen-columns) ; buffer's local value
(last 1)
(loc (compilation-next-error (or n 1) nil
- (or compilation-current-error (point-min))))
+ (or compilation-current-error
+ compilation-messages-start
+ (point-min))))
(end-loc (nth 2 loc))
(marker (point-marker)))
(setq compilation-current-error (point-marker)
overlay-arrow-position
(if (bolp)
compilation-current-error
- (save-excursion
- (beginning-of-line)
- (point-marker)))
+ (copy-marker (line-beginning-position)))
loc (car loc))
;; If loc contains no marker, no error in that file has been visited. If
;; the marker is invalid the buffer has been killed. So, recalculate all
@@ -1447,6 +1457,10 @@ Use this command in a compilation log buffer. Sets the mark at point there."
(compilation-goto-locus marker (nth 3 loc) (nth 3 end-loc))
(setcdr (nthcdr 3 loc) t))) ; Set this one as visited.
+(defvar compilation-gcpro nil
+ "Internal variable used to keep some values from being GC'd.")
+(make-variable-buffer-local 'compilation-gcpro)
+
(defun compilation-fake-loc (marker file &optional line col)
"Preassociate MARKER with FILE.
FILE should be ABSOLUTE-FILENAME or (RELATIVE-FILENAME . DIRNAME).
@@ -1466,6 +1480,11 @@ call this several times, once each for the last line of one
region and the first line of the next region."
(or (consp file) (setq file (list file)))
(setq file (compilation-get-file-structure file))
+ ;; Between the current call to compilation-fake-loc and the first occurrence
+ ;; of an error message referring to `file', the data is only kept is the
+ ;; weak hash-table compilation-locs, so we need to prevent this entry
+ ;; in compilation-locs from being GC'd away. --Stef
+ (push file compilation-gcpro)
(let ((loc (compilation-assq (or line 1) (cdr file))))
(setq loc (compilation-assq col loc))
(if (cdr loc)
@@ -1715,10 +1734,12 @@ FILE should be (ABSOLUTE-FILENAME) or (RELATIVE-FILENAME . DIRNAME)."
(goto-char limit)
nil)
+;; Beware: this is not only compatiblity code. New code stil uses it. --Stef
(defun compilation-forget-errors ()
;; In case we hit the same file/line specs, we want to recompute a new
;; marker for them, so flush our cache.
(setq compilation-locs (make-hash-table :test 'equal :weakness 'value))
+ (setq compilation-gcpro nil)
;; FIXME: the old code reset the directory-stack, so maybe we should
;; put a `directory change' marker of some sort, but where? -stef
;;
@@ -1730,9 +1751,19 @@ FILE should be (ABSOLUTE-FILENAME) or (RELATIVE-FILENAME . DIRNAME)."
;; something equivalent to point-max. So we speculatively move
;; compilation-current-error to point-max (since the external package
;; won't know that it should do it). --stef
- (setq compilation-current-error (point-max)))
+ (setq compilation-current-error nil)
+ (let* ((proc (get-buffer-process (current-buffer)))
+ (mark (if proc (process-mark proc)))
+ (pos (or mark (point-max))))
+ (setq compilation-messages-start
+ ;; In the future, ignore the text already present in the buffer.
+ ;; Since many process filter functions insert before markers,
+ ;; we need to put ours just before the insertion point rather
+ ;; than at the insertion point. If that's not possible, then
+ ;; don't use a marker. --Stef
+ (if (> pos (point-min)) (copy-marker (1- pos)) pos))))
(provide 'compile)
-;;; arch-tag: 12465727-7382-4f72-b234-79855a00dd8c
+;; arch-tag: 12465727-7382-4f72-b234-79855a00dd8c
;;; compile.el ends here