diff options
| author | Daniel Pfeiffer | 2004-04-25 12:55:43 +0000 |
|---|---|---|
| committer | Daniel Pfeiffer | 2004-04-25 12:55:43 +0000 |
| commit | dbd9767235327ab3ea1826a72d62e4ba2d024e31 (patch) | |
| tree | 1cb43516b22ed54876debae6555cc780e3bb70f8 /lisp | |
| parent | e5847e56000711d975acdbfe58bcbf8552f9446f (diff) | |
| download | emacs-dbd9767235327ab3ea1826a72d62e4ba2d024e31.tar.gz emacs-dbd9767235327ab3ea1826a72d62e4ba2d024e31.zip | |
(compilation-error-regexp-alist-alist): Also recognize severe Irix et al. messages.
(compilation-normalize-filename, compile-abbreviate-directory): Delete functions.
(compilation-get-file-structure): New function inherits functionality of the two preceding ones.
(compilation-internal-error-properties, compilation-fake-loc): Use it so that different paths to the same file share the same markers. Also optimize finding adjacent marker slightly.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 142 |
2 files changed, 77 insertions, 77 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9efe40650e0..e6798b48f87 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2004-04-25 Daniel Pfeiffer <occitan@esperanto.org> | ||
| 2 | |||
| 3 | * progmodes/compile.el (compilation-error-regexp-alist-alist): | ||
| 4 | Also recognize severe Irix et al. messages. | ||
| 5 | (compilation-normalize-filename, compile-abbreviate-directory): | ||
| 6 | Delete functions. | ||
| 7 | (compilation-get-file-structure): New function inherits | ||
| 8 | functionality of the two preceding ones. | ||
| 9 | (compilation-internal-error-properties, compilation-fake-loc): Use | ||
| 10 | it so that different paths to the same file share the same | ||
| 11 | markers. Also optimize finding adjacent marker slightly. | ||
| 12 | |||
| 1 | 2004-04-25 Kim F. Storm <storm@cua.dk> | 13 | 2004-04-25 Kim F. Storm <storm@cua.dk> |
| 2 | 14 | ||
| 3 | * image.el (insert-sliced-image): Add line-spacing t property | 15 | * image.el (insert-sliced-image): Add line-spacing t property |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 9aaa992ca76..2c8ead87000 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -184,7 +184,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) | |||
| 184 | 184 | ||
| 185 | ;; fixme: should be `mips' | 185 | ;; fixme: should be `mips' |
| 186 | (irix | 186 | (irix |
| 187 | "^[-[:alnum:]_/]+: \\(?:[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*:\ | 187 | "^[-[:alnum:]_/]+: \\(?:[sS]evere\\|[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*:\ |
| 188 | \\([^,\" \n\t]+\\)\\(?:, line\\|:\\) \\([0-9]+\\):" 3 4 nil (1 . 2)) | 188 | \\([^,\" \n\t]+\\)\\(?:, line\\|:\\) \\([0-9]+\\):" 3 4 nil (1 . 2)) |
| 189 | 189 | ||
| 190 | (java | 190 | (java |
| @@ -587,10 +587,9 @@ Faces `compilation-error-face', `compilation-warning-face', | |||
| 587 | "Get the meta-info that will be added as text-properties. | 587 | "Get the meta-info that will be added as text-properties. |
| 588 | LINE, END-LINE, COL, END-COL are integers or nil. | 588 | LINE, END-LINE, COL, END-COL are integers or nil. |
| 589 | TYPE can be 0, 1, or 2. | 589 | TYPE can be 0, 1, or 2. |
| 590 | FILE should be (FILENAME . DIRNAME) or nil." | 590 | FILE should be (ABSOLUTE-FILENAME) or (RELATIVE-FILENAME . DIRNAME) or nil." |
| 591 | (unless file (setq file '("*unknown*"))) | 591 | (unless file (setq file '("*unknown*"))) |
| 592 | (setq file (or (gethash file compilation-locs) | 592 | (setq file (compilation-get-file-structure file fmt)) |
| 593 | (puthash file (list file fmt) compilation-locs))) | ||
| 594 | ;; Get first already existing marker (if any has one, all have one). | 593 | ;; Get first already existing marker (if any has one, all have one). |
| 595 | ;; Do this first, as the compilation-assq`s may create new nodes. | 594 | ;; Do this first, as the compilation-assq`s may create new nodes. |
| 596 | (let* ((marker-line (car (cddr file))) ; a line structure | 595 | (let* ((marker-line (car (cddr file))) ; a line structure |
| @@ -599,19 +598,17 @@ FILE should be (FILENAME . DIRNAME) or nil." | |||
| 599 | end-marker loc end-loc) | 598 | end-marker loc end-loc) |
| 600 | (if (not (and marker (marker-buffer marker))) | 599 | (if (not (and marker (marker-buffer marker))) |
| 601 | (setq marker) ; no valid marker for this file | 600 | (setq marker) ; no valid marker for this file |
| 602 | (setq loc (or line 1) ; normalize no linenumber to line 1 | 601 | (setq loc (or line 1)) ; normalize no linenumber to line 1 |
| 603 | marker-line) | 602 | (catch 'marker ; find nearest loc, at least one exists |
| 604 | (catch 'marker ; find nearest loc, at least one exists | 603 | (dolist (x (nthcdr 3 file)) ; loop over remaining lines |
| 605 | (dolist (x (cddr file)) ; loop over lines | 604 | (if (> (car x) loc) ; still bigger |
| 606 | (if (> (or (car x) 1) loc) ; still bigger | ||
| 607 | (setq marker-line x) | 605 | (setq marker-line x) |
| 608 | (if (or (not marker-line) ; first in list | 606 | (if (> (- (or (car marker-line) 1) loc) |
| 609 | (> (- (or (car marker-line) 1) loc) | 607 | (- loc (car x))) ; current line is nearer |
| 610 | (- loc (or (car x) 1)))) ; current line is nearer | ||
| 611 | (setq marker-line x)) | 608 | (setq marker-line x)) |
| 612 | (throw 'marker t)))) | 609 | (throw 'marker t)))) |
| 613 | (setq marker (nth 3 (cadr marker-line)) | 610 | (setq marker (nth 3 (cadr marker-line)) |
| 614 | marker-line (car marker-line)) | 611 | marker-line (or (car marker-line) 1)) |
| 615 | (with-current-buffer (marker-buffer marker) | 612 | (with-current-buffer (marker-buffer marker) |
| 616 | (save-restriction | 613 | (save-restriction |
| 617 | (widen) | 614 | (widen) |
| @@ -1451,6 +1448,7 @@ Use this command in a compilation log buffer. Sets the mark at point there." | |||
| 1451 | 1448 | ||
| 1452 | (defun compilation-fake-loc (marker file &optional line col) | 1449 | (defun compilation-fake-loc (marker file &optional line col) |
| 1453 | "Preassociate MARKER with FILE. | 1450 | "Preassociate MARKER with FILE. |
| 1451 | FILE should be ABSOLUTE-FILENAME or (RELATIVE-FILENAME . DIRNAME). | ||
| 1454 | This is useful when you compile temporary files, but want | 1452 | This is useful when you compile temporary files, but want |
| 1455 | automatic translation of the messages to the real buffer from | 1453 | automatic translation of the messages to the real buffer from |
| 1456 | which the temporary file came. This only works if done before a | 1454 | which the temporary file came. This only works if done before a |
| @@ -1466,13 +1464,12 @@ header with variable assignments and a code region), you must | |||
| 1466 | call this several times, once each for the last line of one | 1464 | call this several times, once each for the last line of one |
| 1467 | region and the first line of the next region." | 1465 | region and the first line of the next region." |
| 1468 | (or (consp file) (setq file (list file))) | 1466 | (or (consp file) (setq file (list file))) |
| 1469 | (setq file (or (gethash file compilation-locs) | 1467 | (setq file (compilation-get-file-structure file)) |
| 1470 | (puthash file (list file nil) compilation-locs))) | ||
| 1471 | (let ((loc (compilation-assq (or line 1) (cdr file)))) | 1468 | (let ((loc (compilation-assq (or line 1) (cdr file)))) |
| 1472 | (setq loc (compilation-assq col loc)) | 1469 | (setq loc (compilation-assq col loc)) |
| 1473 | (if (cdr loc) | 1470 | (if (cdr loc) |
| 1474 | (setcdr (cddr loc) (list marker)) | 1471 | (setcdr (cddr loc) (list marker)) |
| 1475 | (setcdr loc (list (or line 1) file marker))) | 1472 | (setcdr loc (list line file marker))) |
| 1476 | loc)) | 1473 | loc)) |
| 1477 | 1474 | ||
| 1478 | (defcustom compilation-context-lines next-screen-context-lines | 1475 | (defcustom compilation-context-lines next-screen-context-lines |
| @@ -1598,67 +1595,58 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." | |||
| 1598 | (overlays-in (point-min) (point-max))) | 1595 | (overlays-in (point-min) (point-max))) |
| 1599 | buffer))) | 1596 | buffer))) |
| 1600 | 1597 | ||
| 1601 | (defun compilation-normalize-filename (filename) | 1598 | (defun compilation-get-file-structure (file &optional fmt) |
| 1602 | "Convert FILENAME string found in an error message to make it usable." | 1599 | "Retrieve FILE's file-structure or create a new one. |
| 1603 | 1600 | FILE should be (ABSOLUTE-FILENAME) or (RELATIVE-FILENAME . DIRNAME)." | |
| 1604 | ;; Check for a comint-file-name-prefix and prepend it if | 1601 | |
| 1605 | ;; appropriate. (This is very useful for | 1602 | (or (gethash file compilation-locs) |
| 1606 | ;; compilation-minor-mode in an rlogin-mode buffer.) | 1603 | ;; File was not previously encountered, at least not in the form passed. |
| 1607 | (and (boundp 'comint-file-name-prefix) | 1604 | ;; Let's normalize it and look again. |
| 1608 | ;; If file name is relative, default-directory will | 1605 | (let ((filename (car file)) |
| 1609 | ;; already contain the comint-file-name-prefix (done | 1606 | (default-directory (if (cdr file) |
| 1610 | ;; by compile-abbreviate-directory). | 1607 | (file-truename (cdr file)) |
| 1611 | (file-name-absolute-p filename) | 1608 | default-directory))) |
| 1612 | (setq filename | 1609 | |
| 1613 | (concat (with-no-warnings 'comint-file-name-prefix) filename))) | 1610 | ;; Check for a comint-file-name-prefix and prepend it if appropriate. |
| 1614 | 1611 | ;; (This is very useful for compilation-minor-mode in an rlogin-mode | |
| 1615 | ;; If compilation-parse-errors-filename-function is | 1612 | ;; buffer.) |
| 1616 | ;; defined, use it to process the filename. | 1613 | (if (boundp 'comint-file-name-prefix) |
| 1617 | (when compilation-parse-errors-filename-function | 1614 | (if (file-name-absolute-p filename) |
| 1618 | (setq filename | 1615 | (setq filename |
| 1619 | (funcall compilation-parse-errors-filename-function | 1616 | (concat (with-no-warnings comint-file-name-prefix) filename)) |
| 1620 | filename))) | 1617 | (setq default-directory |
| 1621 | 1618 | (file-truename | |
| 1622 | ;; Some compilers (e.g. Sun's java compiler, reportedly) | 1619 | (concat (with-no-warnings comint-file-name-prefix) default-directory))))) |
| 1623 | ;; produce bogus file names like "./bar//foo.c" for file | 1620 | |
| 1624 | ;; "bar/foo.c"; expand-file-name will collapse these into | 1621 | ;; If compilation-parse-errors-filename-function is |
| 1625 | ;; "/foo.c" and fail to find the appropriate file. So we | 1622 | ;; defined, use it to process the filename. |
| 1626 | ;; look for doubled slashes in the file name and fix them | 1623 | (when compilation-parse-errors-filename-function |
| 1627 | ;; up in the buffer. | 1624 | (setq filename |
| 1628 | (setq filename (command-line-normalize-file-name filename))) | 1625 | (funcall compilation-parse-errors-filename-function |
| 1629 | 1626 | filename))) | |
| 1630 | 1627 | ||
| 1631 | ;; If directory DIR is a subdir of ORIG or of ORIG's parent, | 1628 | ;; Some compilers (e.g. Sun's java compiler, reportedly) produce bogus |
| 1632 | ;; return a relative name for it starting from ORIG or its parent. | 1629 | ;; file names like "./bar//foo.c" for file "bar/foo.c"; |
| 1633 | ;; ORIG-EXPANDED is an expanded version of ORIG. | 1630 | ;; expand-file-name will collapse these into "/foo.c" and fail to find |
| 1634 | ;; PARENT-EXPANDED is an expanded version of ORIG's parent. | 1631 | ;; the appropriate file. So we look for doubled slashes in the file |
| 1635 | ;; Those two args could be computed here, but we run faster by | 1632 | ;; name and fix them. |
| 1636 | ;; having the caller compute them just once. | 1633 | (setq filename (command-line-normalize-file-name filename)) |
| 1637 | (defun compile-abbreviate-directory (dir orig orig-expanded parent-expanded) | 1634 | |
| 1638 | ;; Apply canonical abbreviations to DIR first thing. | 1635 | ;; Now eliminate any "..", because find-file would get them wrong. |
| 1639 | ;; Those abbreviations are already done in the other arguments passed. | 1636 | ;; Make relative and absolute filenames, with or without links, the |
| 1640 | (setq dir (abbreviate-file-name dir)) | 1637 | ;; same. |
| 1641 | 1638 | (setq filename | |
| 1642 | ;; Check for a comint-file-name-prefix and prepend it if appropriate. | 1639 | (list (abbreviate-file-name |
| 1643 | ;; (This is very useful for compilation-minor-mode in an rlogin-mode | 1640 | (file-truename (if (cdr file) |
| 1644 | ;; buffer.) | 1641 | (expand-file-name filename) |
| 1645 | (if (boundp 'comint-file-name-prefix) | 1642 | filename))))) |
| 1646 | (setq dir (concat comint-file-name-prefix dir))) | 1643 | |
| 1647 | 1644 | ;; Store it for the possibly unnormalized name | |
| 1648 | (if (and (> (length dir) (length orig-expanded)) | 1645 | (puthash file |
| 1649 | (string= orig-expanded | 1646 | ;; Retrieve or create file-structure for normalized name |
| 1650 | (substring dir 0 (length orig-expanded)))) | 1647 | (or (gethash filename compilation-locs) |
| 1651 | (setq dir | 1648 | (puthash filename (list filename fmt) compilation-locs)) |
| 1652 | (concat orig | 1649 | compilation-locs)))) |
| 1653 | (substring dir (length orig-expanded))))) | ||
| 1654 | (if (and (> (length dir) (length parent-expanded)) | ||
| 1655 | (string= parent-expanded | ||
| 1656 | (substring dir 0 (length parent-expanded)))) | ||
| 1657 | (setq dir | ||
| 1658 | (concat (file-name-directory | ||
| 1659 | (directory-file-name orig)) | ||
| 1660 | (substring dir (length parent-expanded))))) | ||
| 1661 | dir) | ||
| 1662 | 1650 | ||
| 1663 | (add-to-list 'debug-ignored-errors "^No more [-a-z ]+s yet$") | 1651 | (add-to-list 'debug-ignored-errors "^No more [-a-z ]+s yet$") |
| 1664 | 1652 | ||