aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2004-05-01 21:13:00 +0000
committerStefan Monnier2004-05-01 21:13:00 +0000
commit9b7b51a21efc3cd1d5986f709e452d37ca33dd99 (patch)
tree86a0ef340245baabd4a013d2fdd28ae0c8710b4a
parenta4683d667dd8ba6d43a3ca0a7737baa7a14d4e18 (diff)
downloademacs-9b7b51a21efc3cd1d5986f709e452d37ca33dd99.tar.gz
emacs-9b7b51a21efc3cd1d5986f709e452d37ca33dd99.zip
(compilation-messages-start): New var.
(compilation-mode): Don't setup next-error-function here. (compilation-setup): Set it up here instead (for minor modes as well). Make compilation-messages-start buffer local. (compilation-next-error-function): Use it. (compilation-forget-errors): Set compilation-messages-start.
-rw-r--r--lisp/progmodes/compile.el34
1 files changed, 25 insertions, 9 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 4c6f88813c0..d31a93311b5 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1095,10 +1095,6 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)."
1095 (set (make-local-variable 'page-delimiter) 1095 (set (make-local-variable 'page-delimiter)
1096 compilation-page-delimiter) 1096 compilation-page-delimiter)
1097 (compilation-setup) 1097 (compilation-setup)
1098 ;; note that compilation-next-error-function is for interfacing
1099 ;; with the next-error function in simple.el, and it's only
1100 ;; coincidentally named similarly to compilation-next-error
1101 (setq next-error-function 'compilation-next-error-function)
1102 (run-mode-hooks 'compilation-mode-hook)) 1098 (run-mode-hooks 'compilation-mode-hook))
1103 1099
1104(defmacro define-compilation-mode (mode name doc &rest body) 1100(defmacro define-compilation-mode (mode name doc &rest body)
@@ -1150,6 +1146,10 @@ variable exists."
1150 "Marker to the location from where the next error will be found. 1146 "Marker to the location from where the next error will be found.
1151The global commands next/previous/first-error/goto-error use this.") 1147The global commands next/previous/first-error/goto-error use this.")
1152 1148
1149(defvar compilation-messages-start nil
1150 "Buffer position of the beginning of the compilation messages.
1151If nil, use the beginning of buffer.")
1152
1153;; A function name can't be a hook, must be something with a value. 1153;; A function name can't be a hook, must be something with a value.
1154(defconst compilation-turn-on-font-lock 'turn-on-font-lock) 1154(defconst compilation-turn-on-font-lock 'turn-on-font-lock)
1155 1155
@@ -1158,8 +1158,13 @@ The global commands next/previous/first-error/goto-error use this.")
1158Optional argument MINOR indicates this is called from 1158Optional argument MINOR indicates this is called from
1159`compilation-minor-mode'." 1159`compilation-minor-mode'."
1160 (make-local-variable 'compilation-current-error) 1160 (make-local-variable 'compilation-current-error)
1161 (make-local-variable 'compilation-messages-start)
1161 (make-local-variable 'compilation-error-screen-columns) 1162 (make-local-variable 'compilation-error-screen-columns)
1162 (make-local-variable 'overlay-arrow-position) 1163 (make-local-variable 'overlay-arrow-position)
1164 ;; Note that compilation-next-error-function is for interfacing
1165 ;; with the next-error function in simple.el, and it's only
1166 ;; coincidentally named similarly to compilation-next-error.
1167 (setq next-error-function 'compilation-next-error-function)
1163 (set (make-local-variable 'font-lock-extra-managed-props) 1168 (set (make-local-variable 'font-lock-extra-managed-props)
1164 '(directory message help-echo mouse-face debug)) 1169 '(directory message help-echo mouse-face debug))
1165 (set (make-local-variable 'compilation-locs) 1170 (set (make-local-variable 'compilation-locs)
@@ -1404,16 +1409,16 @@ Use this command in a compilation log buffer. Sets the mark at point there."
1404 (let* ((columns compilation-error-screen-columns) ; buffer's local value 1409 (let* ((columns compilation-error-screen-columns) ; buffer's local value
1405 (last 1) 1410 (last 1)
1406 (loc (compilation-next-error (or n 1) nil 1411 (loc (compilation-next-error (or n 1) nil
1407 (or compilation-current-error (point-min)))) 1412 (or compilation-current-error
1413 compilation-messages-start
1414 (point-min))))
1408 (end-loc (nth 2 loc)) 1415 (end-loc (nth 2 loc))
1409 (marker (point-marker))) 1416 (marker (point-marker)))
1410 (setq compilation-current-error (point-marker) 1417 (setq compilation-current-error (point-marker)
1411 overlay-arrow-position 1418 overlay-arrow-position
1412 (if (bolp) 1419 (if (bolp)
1413 compilation-current-error 1420 compilation-current-error
1414 (save-excursion 1421 (copy-marker (line-beginning-position)))
1415 (beginning-of-line)
1416 (point-marker)))
1417 loc (car loc)) 1422 loc (car loc))
1418 ;; If loc contains no marker, no error in that file has been visited. If 1423 ;; If loc contains no marker, no error in that file has been visited. If
1419 ;; the marker is invalid the buffer has been killed. So, recalculate all 1424 ;; the marker is invalid the buffer has been killed. So, recalculate all
@@ -1715,6 +1720,7 @@ FILE should be (ABSOLUTE-FILENAME) or (RELATIVE-FILENAME . DIRNAME)."
1715 (goto-char limit) 1720 (goto-char limit)
1716 nil) 1721 nil)
1717 1722
1723;; Beware: this is not only compatiblity code. New code stil uses it. --Stef
1718(defun compilation-forget-errors () 1724(defun compilation-forget-errors ()
1719 ;; In case we hit the same file/line specs, we want to recompute a new 1725 ;; In case we hit the same file/line specs, we want to recompute a new
1720 ;; marker for them, so flush our cache. 1726 ;; marker for them, so flush our cache.
@@ -1730,7 +1736,17 @@ FILE should be (ABSOLUTE-FILENAME) or (RELATIVE-FILENAME . DIRNAME)."
1730 ;; something equivalent to point-max. So we speculatively move 1736 ;; something equivalent to point-max. So we speculatively move
1731 ;; compilation-current-error to point-max (since the external package 1737 ;; compilation-current-error to point-max (since the external package
1732 ;; won't know that it should do it). --stef 1738 ;; won't know that it should do it). --stef
1733 (setq compilation-current-error (point-max))) 1739 (setq compilation-current-error nil)
1740 (let* ((proc (get-buffer-process (current-buffer)))
1741 (mark (if proc (process-mark proc)))
1742 (pos (or mark (point-max))))
1743 (setq compilation-messages-start
1744 ;; In the future, ignore the text already present in the buffer.
1745 ;; Since many process filter functions insert before markers,
1746 ;; we need to put ours just before the insertion point rather
1747 ;; than at the insertion point. If that's not possible, then
1748 ;; don't use a marker. --Stef
1749 (if (> pos (point-min)) (copy-marker (1- pos)) pos))))
1734 1750
1735(provide 'compile) 1751(provide 'compile)
1736 1752