Mercurial > emacs
comparison lisp/progmodes/compile.el @ 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 | 9f8e1f35816d |
children | 89afbe74739e |
comparison
equal
deleted
inserted
replaced
81132:094200bbe6b7 | 81133:1b2ee4e66d28 |
---|---|
36 | 36 |
37 ;; COLUMN and LINE are numbers parsed from an error message. COLUMN and maybe | 37 ;; COLUMN and LINE are numbers parsed from an error message. COLUMN and maybe |
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 ...) ...) |
49 | 52 |
50 ;; FILENAME is a string parsed from an error message. DIRECTORY is a string | 53 ;; FILENAME is a string parsed from an error message. DIRECTORY is a string |
1514 (or (< (cadr msg) compilation-skip-threshold) | 1517 (or (< (cadr msg) compilation-skip-threshold) |
1515 (if different-file | 1518 (if different-file |
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 |
1523 (setq n (,1+ n)))))) | 1526 (setq n (,1+ n)))))) |
1524 | 1527 |
1617 This is the value of `next-error-function' in Compilation buffers." | 1620 This is the value of `next-error-function' in Compilation buffers." |
1618 (interactive "p") | 1621 (interactive "p") |
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 |
1626 (point-min)))) | 1629 (point-min)))) |
1627 (end-loc (nth 2 loc)) | 1630 (end-loc (nth 2 loc)) |
1630 overlay-arrow-position | 1633 overlay-arrow-position |
1631 (if (bolp) | 1634 (if (bolp) |
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 |
1642 (widen) | 1652 (widen) |
1643 (goto-char (point-min)) | 1653 (goto-char (point-min)) |
1656 (skip-chars-forward " \t")) | 1666 (skip-chars-forward " \t")) |
1657 (if (nth 3 col) | 1667 (if (nth 3 col) |
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.") |
1665 (make-variable-buffer-local 'compilation-gcpro) | 1676 (make-variable-buffer-local 'compilation-gcpro) |
1666 | 1677 |