diff options
author | Sam Steingold <[email protected]> | 2007-06-03 18:56:15 +0000 |
---|---|---|
committer | Sam Steingold <[email protected]> | 2007-06-03 18:56:15 +0000 |
commit | b84acff63cd7d71318fd8d0d17316db390e81dc4 (patch) | |
tree | 1126dabe62d46fb2b4b8491560d4b869401dda0b /lisp | |
parent | a151f82c4396c7ad8de905ff97c52ff0405d2f8b (diff) |
Add TIMESTAMP to LOC to handle "incremental compilation", e.g.,
with `omake -P': the compilation process never terminates and
automatically recompiles modified files.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 10 | ||||
-rw-r--r-- | lisp/progmodes/compile.el | 29 |
2 files changed, 29 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3d3bf598a7..6dd872e148 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,4 +1,12 @@ -2007-06-03 Sam Steingold <[email protected]> +2007-05-01 Sam Steingold <[email protected]> + + 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 <[email protected]> * files.el (kill-buffer-ask): New function. (kill-some-buffers): Use it. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 7701809463..b3a7da069d 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -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.") |