Mercurial > emacs
changeset 81133:1b2ee4e66d28
Add TIMESTAMP to LOC to handle "incremental compilation", e.g.,
with `omake -P': the compilation process never terminates and
automatically recompiles modified files.
author | Sam Steingold <sds@gnu.org> |
---|---|
date | Sun, 03 Jun 2007 18:56:15 +0000 |
parents | 094200bbe6b7 |
children | 46c78a4184dd |
files | lisp/ChangeLog lisp/progmodes/compile.el |
diffstat | 2 files changed, 29 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun Jun 03 18:51:42 2007 +0000 +++ b/lisp/ChangeLog Sun Jun 03 18:56:15 2007 +0000 @@ -1,4 +1,12 @@ -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.
--- a/lisp/progmodes/compile.el Sun Jun 03 18:51:42 2007 +0000 +++ b/lisp/progmodes/compile.el Sun Jun 03 18:56:15 2007 +0000 @@ -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 @@ (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 @@ (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 @@ 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 @@ (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.")