diff options
| author | Sam Steingold | 2007-06-03 18:56:15 +0000 |
|---|---|---|
| committer | Sam Steingold | 2007-06-03 18:56:15 +0000 |
| commit | b84acff63cd7d71318fd8d0d17316db390e81dc4 (patch) | |
| tree | 1126dabe62d46fb2b4b8491560d4b869401dda0b | |
| parent | a151f82c4396c7ad8de905ff97c52ff0405d2f8b (diff) | |
| download | emacs-b84acff63cd7d71318fd8d0d17316db390e81dc4.tar.gz emacs-b84acff63cd7d71318fd8d0d17316db390e81dc4.zip | |
Add TIMESTAMP to LOC to handle "incremental compilation", e.g.,
with `omake -P': the compilation process never terminates and
automatically recompiles modified files.
| -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 3d3bf598a78..6dd872e1482 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,4 +1,12 @@ | |||
| 1 | 2007-06-03 Sam Steingold <sds@gnu.org> | 1 | 2007-05-01 Sam Steingold <sds@gnu.org> |
| 2 | |||
| 3 | Add TIMESTAMP to LOC to handle "incremental compilation", e.g., | ||
| 4 | with `omake -P': the compilation process never terminates and | ||
| 5 | automatically recompiles modified files. | ||
| 6 | * progmodes/compile.el (compilation-loop): VISITED is not 5th CDR. | ||
| 7 | (compilation-next-error-function): Set TIMESTAMP. | ||
| 8 | |||
| 9 | 2007-05-15 Sam Steingold <sds@gnu.org> | ||
| 2 | 10 | ||
| 3 | * files.el (kill-buffer-ask): New function. | 11 | * files.el (kill-buffer-ask): New function. |
| 4 | (kill-some-buffers): Use it. | 12 | (kill-some-buffers): Use it. |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 7701809463d..b3a7da069d2 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -38,11 +38,14 @@ | |||
| 38 | ;; LINE will be nil for a message that doesn't contain them. Then the | 38 | ;; LINE will be nil for a message that doesn't contain them. Then the |
| 39 | ;; location refers to a indented beginning of line or beginning of file. | 39 | ;; location refers to a indented beginning of line or beginning of file. |
| 40 | ;; Once any location in some file has been jumped to, the list is extended to | 40 | ;; Once any location in some file has been jumped to, the list is extended to |
| 41 | ;; (COLUMN LINE FILE-STRUCTURE MARKER . VISITED) for all LOCs pertaining to | 41 | ;; (COLUMN LINE FILE-STRUCTURE MARKER TIMESTAMP . VISITED) |
| 42 | ;; that file. | 42 | ;; for all LOCs pertaining to that file. |
| 43 | ;; MARKER initially points to LINE and COLUMN in a buffer visiting that file. | 43 | ;; MARKER initially points to LINE and COLUMN in a buffer visiting that file. |
| 44 | ;; Being a marker it sticks to some text, when the buffer grows or shrinks | 44 | ;; Being a marker it sticks to some text, when the buffer grows or shrinks |
| 45 | ;; before that point. VISITED is t if we have jumped there, else nil. | 45 | ;; before that point. VISITED is t if we have jumped there, else nil. |
| 46 | ;; TIMESTAMP is necessary because of "incremental compilation": `omake -P' | ||
| 47 | ;; polls filesystem for changes and recompiles when a file is modified | ||
| 48 | ;; using the same *compilation* buffer. this necessitates re-parsing markers. | ||
| 46 | 49 | ||
| 47 | ;; FILE-STRUCTURE is a list of | 50 | ;; FILE-STRUCTURE is a list of |
| 48 | ;; ((FILENAME . DIRECTORY) FORMATS (LINE LOC ...) ...) | 51 | ;; ((FILENAME . DIRECTORY) FORMATS (LINE LOC ...) ...) |
| @@ -1516,7 +1519,7 @@ Just inserts the text, but uses `insert-before-markers'." | |||
| 1516 | (eq (prog1 last (setq last (nth 2 (car msg)))) | 1519 | (eq (prog1 last (setq last (nth 2 (car msg)))) |
| 1517 | last)) | 1520 | last)) |
| 1518 | (if compilation-skip-visited | 1521 | (if compilation-skip-visited |
| 1519 | (nthcdr 4 (car msg))) | 1522 | (nthcdr 5 (car msg))) |
| 1520 | (if compilation-skip-to-next-location | 1523 | (if compilation-skip-to-next-location |
| 1521 | (eq (car msg) loc)) | 1524 | (eq (car msg) loc)) |
| 1522 | ;; count this message only if none of the above are true | 1525 | ;; 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." | |||
| 1619 | (when reset | 1622 | (when reset |
| 1620 | (setq compilation-current-error nil)) | 1623 | (setq compilation-current-error nil)) |
| 1621 | (let* ((columns compilation-error-screen-columns) ; buffer's local value | 1624 | (let* ((columns compilation-error-screen-columns) ; buffer's local value |
| 1622 | (last 1) | 1625 | (last 1) timestamp |
| 1623 | (loc (compilation-next-error (or n 1) nil | 1626 | (loc (compilation-next-error (or n 1) nil |
| 1624 | (or compilation-current-error | 1627 | (or compilation-current-error |
| 1625 | compilation-messages-start | 1628 | compilation-messages-start |
| @@ -1632,10 +1635,17 @@ This is the value of `next-error-function' in Compilation buffers." | |||
| 1632 | compilation-current-error | 1635 | compilation-current-error |
| 1633 | (copy-marker (line-beginning-position))) | 1636 | (copy-marker (line-beginning-position))) |
| 1634 | loc (car loc)) | 1637 | loc (car loc)) |
| 1635 | ;; If loc contains no marker, no error in that file has been visited. If | 1638 | ;; If loc contains no marker, no error in that file has been visited. |
| 1636 | ;; the marker is invalid the buffer has been killed. So, recalculate all | 1639 | ;; If the marker is invalid the buffer has been killed. |
| 1637 | ;; markers for that file. | 1640 | ;; If the file is newer than the timestamp, it has been modified |
| 1638 | (unless (and (nth 3 loc) (marker-buffer (nth 3 loc))) | 1641 | ;; (`omake -P' polls filesystem for changes and recompiles when needed |
| 1642 | ;; in the same process and buffer). | ||
| 1643 | ;; So, recalculate all markers for that file. | ||
| 1644 | (unless (and (nth 3 loc) (marker-buffer (nth 3 loc)) | ||
| 1645 | (equal (nth 4 loc) | ||
| 1646 | (setq timestamp | ||
| 1647 | (with-current-buffer (marker-buffer (nth 3 loc)) | ||
| 1648 | (visited-file-modtime))))) | ||
| 1639 | (with-current-buffer (compilation-find-file marker (caar (nth 2 loc)) | 1649 | (with-current-buffer (compilation-find-file marker (caar (nth 2 loc)) |
| 1640 | (cadr (car (nth 2 loc)))) | 1650 | (cadr (car (nth 2 loc)))) |
| 1641 | (save-restriction | 1651 | (save-restriction |
| @@ -1658,7 +1668,8 @@ This is the value of `next-error-function' in Compilation buffers." | |||
| 1658 | (set-marker (nth 3 col) (point)) | 1668 | (set-marker (nth 3 col) (point)) |
| 1659 | (setcdr (nthcdr 2 col) `(,(point-marker))))))))) | 1669 | (setcdr (nthcdr 2 col) `(,(point-marker))))))))) |
| 1660 | (compilation-goto-locus marker (nth 3 loc) (nth 3 end-loc)) | 1670 | (compilation-goto-locus marker (nth 3 loc) (nth 3 end-loc)) |
| 1661 | (setcdr (nthcdr 3 loc) t))) ; Set this one as visited. | 1671 | (setcdr (nthcdr 3 loc) (list timestamp)) |
| 1672 | (setcdr (nthcdr 4 loc) t))) ; Set this one as visited. | ||
| 1662 | 1673 | ||
| 1663 | (defvar compilation-gcpro nil | 1674 | (defvar compilation-gcpro nil |
| 1664 | "Internal variable used to keep some values from being GC'd.") | 1675 | "Internal variable used to keep some values from being GC'd.") |