branch: externals/auctex
commit 17115360b88ca23a69f6361477891681efeec6bf
Author: Mosè Giordano <[email protected]>
Commit: Mosè Giordano <[email protected]>
Fix detection of line number in TeX-warning
* tex-buf.el (TeX-warning): Require as additional mandatory argument the
position where the warning starts. Use it to limit
`re-search-backward' when looking for the line number.
(TeX-parse-error): Provide additional argument to `TeX-warning'.
* tests/tex/compilation-log.txt: Add another case where the line number
of the warning was mistaken.
* tests/tex/error-parsing.el: Update expected result of the test
accordingly.
---
tests/tex/compilation-log.txt | 3 +++
tests/tex/error-parsing.el | 7 +++++--
tex-buf.el | 14 +++++++++-----
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/tests/tex/compilation-log.txt b/tests/tex/compilation-log.txt
index 7703865..2e8e00f 100644
--- a/tests/tex/compilation-log.txt
+++ b/tests/tex/compilation-log.txt
@@ -36,6 +36,9 @@ Underfull \hbox (badness 6608) in paragraph at lines 131--132
LaTeX Warning: Reference `wrong' on page 1 undefined on input line 4.
+LaTeX Font Warning: Font shape `OML/cmm/b/it' in size <5.5> not available
+(Font) size <5> substituted on input line 70.
+
[1{/opt/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./test.aux)
LaTeX Warning: There were undefined references.
diff --git a/tests/tex/error-parsing.el b/tests/tex/error-parsing.el
index 611ba8d..6251847 100644
--- a/tests/tex/error-parsing.el
+++ b/tests/tex/error-parsing.el
@@ -87,7 +87,10 @@ ABD: EveryShipout initializing macros"
0
"LaTeX Warning: Reference `wrong' on page 1 undefined on input
line 4.
"
"wrong" 4 nil 1351 nil)
- (warning "./test.tex" 4 "LaTeX Warning: There were undefined
references."
- 0 "LaTeX Warning: There were undefined references.
" nil 4 nil 1482 nil)))))
+ (warning "./test.tex" 70 "LaTeX Font Warning: Font shape
`OML/cmm/b/it' in size <5.5> not available"
+ 0 "LaTeX Font Warning: Font shape `OML/cmm/b/it' in size <5.5>
not available
+(Font) size <5> substituted on input line 70.
" nil 70 nil 1485 nil)
+ (warning "./test.tex" nil "LaTeX Warning: There were undefined
references."
+ 0 "LaTeX Warning: There were undefined references.
" nil nil nil 1616 nil)))))
;;; error-parsing.el ends here
diff --git a/tex-buf.el b/tex-buf.el
index 655faeb..52483dc 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -2362,7 +2362,7 @@ Return non-nil if an error or warning is found."
(if (or store TeX-debug-bad-boxes)
(progn
(setq error-found t)
- (TeX-warning (TeX-match-buffer 7) store)
+ (TeX-warning (TeX-match-buffer 7) (match-beginning 7) store)
nil)
(re-search-forward "
?
\
\(?:.\{79\}
?
\
@@ -2375,7 +2375,7 @@ Return non-nil if an error or warning is found."
(if (or store TeX-debug-warnings)
(progn
(setq error-found t)
- (TeX-warning (TeX-match-buffer 8) store)
+ (TeX-warning (TeX-match-buffer 8) (match-beginning 8) store)
nil)
t))
@@ -2552,9 +2552,11 @@ information in `TeX-error-list' instead of displaying
the error."
;; Find the error point and display the help.
(apply 'TeX-find-display-help info-list))))
-(defun TeX-warning (warning &optional store)
+(defun TeX-warning (warning warning-start &optional store)
"Display a warning for WARNING.
+WARNING-START is the position where WARNING starts.
+
If optional argument STORE is non-nil, store the warning
information in `TeX-error-list' instead of displaying the
warning."
@@ -2568,8 +2570,10 @@ warning."
(word-string (if bad-box "[][\W() ---]\(\w+\)[][\W() ---]*$"
"`\(\w+\)'"))
- ;; Get error-line (warning).
- (line (when (save-excursion (re-search-backward line-string nil t))
+ ;; Get error-line (warning). Don't search before `warning-start' to
+ ;; avoid catching completely unrelated line numbers.
+ (line (when (save-excursion (re-search-backward line-string
+ warning-start t))
(string-to-number (TeX-match-buffer 1))))
(line-end (if bad-box (string-to-number (TeX-match-buffer 2))
line))
_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel