monnier pushed a commit to branch externals/auctex
in repository elpa.
commit b9fa19d8bba1889308ec0f94d2f9fba60fdc6968
Author: Mosè Giordano <[email protected]>
Date: Mon Jun 2 12:58:17 2014 +0200
Fix possible infinite loop in TeX-parse-all-errors.
* tex-buf.el (TeX-warning): Preserve point when searching backward. In
some cases this prevents infinite loops in `TeX-parse-all-errors' and
fixes wrong detection of context string.
---
ChangeLog | 3 +++
tex-buf.el | 7 ++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e8a16bf..109025e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,9 @@
(TeX-error-description-help): Ditto.
(TeX-help-error): Add new `type' argument. Color help messages
using the new faces.
+ (TeX-warning): Preserve point when searching backward. In some
+ cases this prevents infinite loops in `TeX-parse-all-errors' and
+ fixes wrong detection of context string.
2014-05-27 Mos� Giordano <[email protected]>
diff --git a/tex-buf.el b/tex-buf.el
index 614f156..790feee 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -1798,8 +1798,8 @@ warning."
(word-string (if bad-box "[][\\W() ---]\\(\\w+\\)[][\\W() ---]*$"
"`\\(\\w+\\)'"))
- ;; Get error-line (warning)
- (line (when (re-search-backward line-string nil t)
+ ;; Get error-line (warning).
+ (line (when (save-excursion (re-search-backward line-string nil t))
(string-to-number (TeX-match-buffer 1))))
(line-end (if bad-box (string-to-number (TeX-match-buffer 2))
line))
@@ -1821,7 +1821,8 @@ warning."
(error-point (point))
;; Now find the error word.
- (string (when (re-search-backward word-string context-start t)
+ (string (when (save-excursion
+ (re-search-backward word-string context-start t))
(TeX-match-buffer 1)))
;; We might use these in another file.