Commit b84acff6 authored by Sam Steingold's avatar Sam Steingold
Browse files

Add TIMESTAMP to LOC to handle "incremental compilation", e.g.,

with `omake -P': the compilation process never terminates and
automatically recompiles modified files.
parent a151f82c
2007-06-03 Sam Steingold <sds@gnu.org>
2007-05-01 Sam Steingold <sds@gnu.org>
Add TIMESTAMP to LOC to handle "incremental compilation", e.g.,
with `omake -P': the compilation process never terminates and
automatically recompiles modified files.
* progmodes/compile.el (compilation-loop): VISITED is not 5th CDR.
(compilation-next-error-function): Set TIMESTAMP.
2007-05-15 Sam Steingold <sds@gnu.org>
* files.el (kill-buffer-ask): New function.
(kill-some-buffers): Use it.
......
......@@ -38,11 +38,14 @@
;; LINE will be nil for a message that doesn't contain them. Then the
;; location refers to a indented beginning of line or beginning of file.
;; Once any location in some file has been jumped to, the list is extended to
;; (COLUMN LINE FILE-STRUCTURE MARKER . VISITED) for all LOCs pertaining to
;; that file.
;; (COLUMN LINE FILE-STRUCTURE MARKER TIMESTAMP . VISITED)
;; for all LOCs pertaining to that file.
;; MARKER initially points to LINE and COLUMN in a buffer visiting that file.
;; Being a marker it sticks to some text, when the buffer grows or shrinks
;; before that point. VISITED is t if we have jumped there, else nil.
;; TIMESTAMP is necessary because of "incremental compilation": `omake -P'
;; polls filesystem for changes and recompiles when a file is modified
;; using the same *compilation* buffer. this necessitates re-parsing markers.
;; FILE-STRUCTURE is a list of
;; ((FILENAME . DIRECTORY) FORMATS (LINE LOC ...) ...)
......@@ -1516,7 +1519,7 @@ Just inserts the text, but uses `insert-before-markers'."
(eq (prog1 last (setq last (nth 2 (car msg))))
last))
(if compilation-skip-visited
(nthcdr 4 (car msg)))
(nthcdr 5 (car msg)))
(if compilation-skip-to-next-location
(eq (car msg) loc))
;; count this message only if none of the above are true
......@@ -1619,7 +1622,7 @@ This is the value of `next-error-function' in Compilation buffers."
(when reset
(setq compilation-current-error nil))
(let* ((columns compilation-error-screen-columns) ; buffer's local value
(last 1)
(last 1) timestamp
(loc (compilation-next-error (or n 1) nil
(or compilation-current-error
compilation-messages-start
......@@ -1632,10 +1635,17 @@ This is the value of `next-error-function' in Compilation buffers."
compilation-current-error
(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
;; markers for that file.
(unless (and (nth 3 loc) (marker-buffer (nth 3 loc)))
;; If loc contains no marker, no error in that file has been visited.
;; If the marker is invalid the buffer has been killed.
;; If the file is newer than the timestamp, it has been modified
;; (`omake -P' polls filesystem for changes and recompiles when needed
;; in the same process and buffer).
;; So, recalculate all markers for that file.
(unless (and (nth 3 loc) (marker-buffer (nth 3 loc))
(equal (nth 4 loc)
(setq timestamp
(with-current-buffer (marker-buffer (nth 3 loc))
(visited-file-modtime)))))
(with-current-buffer (compilation-find-file marker (caar (nth 2 loc))
(cadr (car (nth 2 loc))))
(save-restriction
......@@ -1658,7 +1668,8 @@ This is the value of `next-error-function' in Compilation buffers."
(set-marker (nth 3 col) (point))
(setcdr (nthcdr 2 col) `(,(point-marker)))))))))
(compilation-goto-locus marker (nth 3 loc) (nth 3 end-loc))
(setcdr (nthcdr 3 loc) t))) ; Set this one as visited.
(setcdr (nthcdr 3 loc) (list timestamp))
(setcdr (nthcdr 4 loc) t))) ; Set this one as visited.
(defvar compilation-gcpro nil
"Internal variable used to keep some values from being GC'd.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment