aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1997-09-12 19:53:33 +0000
committerRichard M. Stallman1997-09-12 19:53:33 +0000
commitbb40e751bee9a783decb1b0a80d2775056d46902 (patch)
treed67014df88223abb8ecd37676bcffe222117affb /lisp
parent5aa3f181e54bde9a86092ba55554daa777d9c32c (diff)
downloademacs-bb40e751bee9a783decb1b0a80d2775056d46902.tar.gz
emacs-bb40e751bee9a783decb1b0a80d2775056d46902.zip
(compilation-parse-errors): Fixed two bugs that
could make compilation-parse-errors loop infinitely. Each round of the parsing loop now either moves point ahead at least a line or sets `found-desired' to true to stop the loop.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/compile.el114
1 files changed, 58 insertions, 56 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 4eaf4b49681..474f271869a 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1692,53 +1692,55 @@ An error message with no file name and no file name has been seen earlier."))
1692 ;; location, and the file and line number of the error. 1692 ;; location, and the file and line number of the error.
1693 ;; Save, as the start of the error, the beginning of the 1693 ;; Save, as the start of the error, the beginning of the
1694 ;; line containing the match. 1694 ;; line containing the match.
1695 (if (setq this-error 1695 (setq this-error
1696 (if (numberp linenum) 1696 (if (numberp linenum)
1697 (list (point-marker) filename linenum 1697 (list (point-marker) filename linenum
1698 (and column (string-to-int column))) 1698 (and column (string-to-int column)))
1699 ;; If linenum is not a number then it must be 1699 ;; If linenum is not a number then it must be
1700 ;; a function returning an error position 1700 ;; a function returning an error position
1701 ;; descriptor or nil (meaning no position). 1701 ;; descriptor or nil (meaning no position).
1702 (save-excursion 1702 (save-excursion
1703 (funcall linenum filename column)))) 1703 (funcall linenum filename column))))
1704 1704
1705 ;; We have an error position descriptor. 1705 ;; We have an error position descriptor.
1706 ;; If we have found as many new errors as the user 1706 ;; If we have found as many new errors as the user
1707 ;; wants, or if we are past the buffer position he 1707 ;; wants, or if we are past the buffer position he
1708 ;; indicated, then we continue to parse until we have 1708 ;; indicated, then we continue to parse until we have
1709 ;; seen all consecutive errors in the same file. This 1709 ;; seen all consecutive errors in the same file. This
1710 ;; means that all the errors of a source file will be 1710 ;; means that all the errors of a source file will be
1711 ;; seen in one parsing run, so that the error positions 1711 ;; seen in one parsing run, so that the error positions
1712 ;; will be recorded as markers in the source file 1712 ;; will be recorded as markers in the source file
1713 ;; buffer that will move when the buffer is changed. 1713 ;; buffer that will move when the buffer is changed.
1714 (if (and (or (and find-at-least 1714 (if (and this-error
1715 (>= compilation-num-errors-found 1715 compilation-error-list ; At least one previous.
1716 find-at-least)) 1716 (or (and find-at-least
1717 (and limit-search 1717 (>= compilation-num-errors-found
1718 (>= end-of-match limit-search))) 1718 find-at-least))
1719 compilation-error-list ;At least one previous. 1719 (and limit-search
1720 (not (equal ; Same filename? 1720 (>= end-of-match limit-search)))
1721 (car (cdr (car compilation-error-list))) 1721 (not (equal ; Same filename?
1722 (car (cdr this-error))))) 1722 (car (cdr (car compilation-error-list)))
1723 ;; We are past the limits and the last error 1723 (car (cdr this-error)))))
1724 ;; parsed, didn't belong to the same source file 1724 ;; We are past the limits and the last error
1725 ;; as the earlier ones i.e. we have seen all the 1725 ;; parsed, didn't belong to the same source file
1726 ;; errors belonging to the earlier file. We don't 1726 ;; as the earlier ones i.e. we have seen all the
1727 ;; add the error just parsed so that the next 1727 ;; errors belonging to the earlier file. We don't
1728 ;; parsing run can get it and the following errors 1728 ;; add the error just parsed so that the next
1729 ;; in the same file all at once. 1729 ;; parsing run can get it and the following errors
1730 (setq found-desired t) 1730 ;; in the same file all at once.
1731 1731 (setq found-desired t)
1732 (goto-char end-of-match) ; Prepare for next message. 1732
1733 ;; Don't add the same source line more than once. 1733 (goto-char end-of-match) ; Prepare for next message.
1734 (and (not (and 1734 ;; Don't add the same source line more than once.
1735 compilation-error-list 1735 (and this-error
1736 (equal (cdr (car compilation-error-list)) 1736 (not (and
1737 (cdr this-error)))) 1737 compilation-error-list
1738 (setq compilation-error-list 1738 (equal (cdr (car compilation-error-list))
1739 (cons this-error compilation-error-list) 1739 (cdr this-error))))
1740 compilation-num-errors-found 1740 (setq compilation-error-list
1741 (1+ compilation-num-errors-found)))))) 1741 (cons this-error compilation-error-list)
1742 compilation-num-errors-found
1743 (1+ compilation-num-errors-found)))))
1742 1744
1743 ;; Not an error message. 1745 ;; Not an error message.
1744 (if (eq type `file) ; Change current file. 1746 (if (eq type `file) ; Change current file.
@@ -1767,16 +1769,16 @@ An error message with no file name and no file name has been seen earlier."))
1767 stack 1769 stack
1768 (setq compilation-directory-stack (cdr stack)) 1770 (setq compilation-directory-stack (cdr stack))
1769 (setq stack (car compilation-directory-stack)) 1771 (setq stack (car compilation-directory-stack))
1770 (setq default-directory stack)) 1772 (setq default-directory stack)))
1771 (goto-char end-of-match) ; Prepare to look at next message. 1773 (goto-char end-of-match) ; Prepare to look at next message.
1772 (and limit-search (>= end-of-match limit-search) 1774 (and limit-search (>= end-of-match limit-search)
1773 ;; The user wanted a specific error, and we're past it. 1775 ;; The user wanted a specific error, and we're past it.
1774 ;; We do this check here rather than at the end of the 1776 ;; We do this check here rather than at the end of the
1775 ;; loop because if the last thing seen is an error 1777 ;; loop because if the last thing seen is an error
1776 ;; message, we must carefully discard the last error 1778 ;; message, we must carefully discard the last error
1777 ;; when it is the first in a new file (see above in 1779 ;; when it is the first in a new file (see above in
1778 ;; the error-message case) 1780 ;; the error-message case)
1779 (setq found-desired t)))) 1781 (setq found-desired t)))
1780 1782
1781 ;; Go to before the last character in the message so that we will 1783 ;; Go to before the last character in the message so that we will
1782 ;; see the next line also when the message ended at end of line. 1784 ;; see the next line also when the message ended at end of line.