[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 2c21439 41/69: Improve parsing of certain warnin
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 2c21439 41/69: Improve parsing of certain warnings |
Date: |
Sat, 26 Mar 2016 21:36:35 +0000 |
branch: externals/auctex
commit 2c21439771b038682814b239dfba0b8d799d487c
Author: Mosè Giordano <address@hidden>
Commit: Mosè Giordano <address@hidden>
Improve parsing of certain warnings
* tex-buf.el (TeX-warning): Get full context and line numbers for
warnings matching `LaTeX-warnings-regexp'.
* tests/tex/compilation-log.txt: Add example warnings for this case.
* tests/tex/error-parsing.el: Update result of test accordingly.
---
tests/tex/compilation-log.txt | 36 +++++++++++++++++++++++++++++++++---
tests/tex/error-parsing.el | 40 ++++++++++++++++++++++++++++++++++++----
tex-buf.el | 24 +++++++++++++++++++++++-
3 files changed, 92 insertions(+), 8 deletions(-)
diff --git a/tests/tex/compilation-log.txt b/tests/tex/compilation-log.txt
index 98b3422..f97b300 100644
--- a/tests/tex/compilation-log.txt
+++ b/tests/tex/compilation-log.txt
@@ -1,13 +1,43 @@
-(./test.tex
+(./test.tex (./nice-class.cls
+Document Class: nice-class 1970/01/01 v42 A good class
+
+Package nice-class Warning: ******************************************
+(nice-class) * THIS IS JUST A WARNING WITH A PESKY
+(nice-class) * UNMATCHED CLOSED PARENTHESIS :-)
+(nice-class) ****************************************** on
input line 32.
+
+)
+
(/opt/texlive/2015/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)
-Package foo Warning: This is a warning!
+./test.tex:2: Class nice-class Error: ***********************************
+(nice-class) * This is a very bad error!
+(nice-class) ************************************.
+
+See the suftesi class documentation for explanation.
+Type H <return> for immediate help.
+ ...
+
+l.2 \begin{document}
+
+(/other/packages/loaded.sty)
+ABD: EveryShipout initializing macros
+
+Package foo Warning: This is a warning! on input line 3.
[1{/opt/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./test.aux)
(./secondary-file.tex [8] [9] [10]
Underfull \hbox (badness 6608) in paragraph at lines 131--132
[]|\T1/jkpl/m/n/10.95 (+20) Something bla
-[11] [12]))
+[11] [12])
+
+LaTeX Warning: Reference `wrong' on page 1 undefined on input line 4.
+
+[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 ce09750..b826fc3 100644
--- a/tests/tex/error-parsing.el
+++ b/tests/tex/error-parsing.el
@@ -49,13 +49,45 @@ command line and from another directory."
(insert-file-contents TeX-test-compilation-log)
(TeX-parse-all-errors)
TeX-error-list)
- '((warning "./test.tex" nil "Package foo Warning: This is a warning!"
- 0 "Package foo Warning: This is a warning!\n"
- nil nil nil 170)
+ '((warning
+ "./nice-class.cls" 32
+ "Package nice-class Warning:
******************************************"
+ 0
+ "Package nice-class Warning:
******************************************
+(nice-class) * THIS IS JUST A WARNING WITH A PESKY
+(nice-class) * UNMATCHED CLOSED PARENTHESIS :-)
+(nice-class) ****************************************** on
input line 32.\n"
+ nil 32 nil 376)
+ (error
+ "./test.tex" 2
+ "Class nice-class Error: ***********************************" 0
+ "\n(nice-class) * This is a very bad error!
+(nice-class) ************************************.
+
+See the suftesi class documentation for explanation.
+Type H <return> for immediate help.
+ ...
+
+l.2 \\begin{document}
+
+(/other/packages/loaded.sty)
+ABD: EveryShipout initializing macros"
+ "\\begin{document}\n\n(/other/packages/loaded.sty)" nil nil 971)
+ (warning "./test.tex" 3
+ "Package foo Warning: This is a warning! on input line 3." 0
+ "Package foo Warning: This is a warning! on input line 3.\n"
+ nil 3 nil 1030)
(bad-box
"./secondary-file.tex" 131
"Underfull \\hbox (badness 6608) in paragraph at lines 131--132"
0 "\n[]|\\T1/jkpl/m/n/10.95 (+20) Something bla" "bla"
- 132 10 391)))))
+ 132 10 1251)
+ (warning "./test.tex" 4
+ "LaTeX Warning: Reference `wrong' on page 1 undefined on input
line 4."
+ 0
+ "LaTeX Warning: Reference `wrong' on page 1 undefined on input
line 4.\n"
+ "wrong" 4 nil 1334)
+ (warning "./test.tex" 4 "LaTeX Warning: There were undefined
references."
+ 0 "LaTeX Warning: There were undefined references.\n" nil 4 nil
1465)))))
;;; error-parsing.el ends here
diff --git a/tex-buf.el b/tex-buf.el
index 0d924c7..3ba1f87 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -2510,7 +2510,18 @@ warning."
(beginning-of-line))
(point)))
- (context (progn
+ (context (if (string-match LaTeX-warnings-regexp warning)
+ ;; The warnings matching `LaTeX-warnings-regexp' are
+ ;; emitted by \GenericWarning macro, or macros based on it
+ ;; (\ClassWarning, \PackageWarning, etc). After such
+ ;; warnings there is an empty line, just look for it to
+ ;; find the end.
+ (progn
+ (beginning-of-line)
+ (while (null (eolp))
+ (forward-line 1))
+ (buffer-substring context-start (progn (end-of-line)
+ (point))))
(forward-line 1)
(end-of-line)
(while (equal (current-column) 79)
@@ -2530,6 +2541,17 @@ warning."
(offset (or (car TeX-error-offset) 0))
(file (car TeX-error-file)))
+ ;; Second chance to get line number right. If `line' is nil, check whether
+ ;; the reference to the line number is in `context'. For example, this is
+ ;; the case for warnings emitted with \ClassWarning and \PackageWarning.
+ ;; XXX: maybe it suffices to evaluate `line' after `context' above, but I
+ ;; don't know if there are cases in which it's important to get `line'
+ ;; before `context'.
+ (and (null line)
+ (string-match line-string context)
+ (setq line-end
+ (setq line (string-to-number (match-string 1 context)))))
+
;; This is where we start next time.
(goto-char error-point)
(setq TeX-error-point (point))
- [elpa] externals/auctex f1bcbe3 54/69: Improve LaTeX-warnings-regexp, (continued)
- [elpa] externals/auctex f1bcbe3 54/69: Improve LaTeX-warnings-regexp, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 08ae29b 19/69: Merge branch 'master' into simplify-TeX-parse-error, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 53f2fab 53/69: Another fix for TeX-parse-errro, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex d7f443e 37/69: Add script to update the ChangeLog, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 8b2550e 16/69: Merge branch 'master' into simplify-TeX-parse-error, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 2fd59c9 60/69: Improve word-string regexp in TeX-warning, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 43ba124 23/69: Merge branch 'master' into simplify-TeX-parse-error, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 1711536 55/69: Fix detection of line number in TeX-warning, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 2e543ef 58/69: Fix parsing of vertical bad boxes context, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 30fe0e9 63/69: Ensure LaTeX-indent-environment-list environments aren't filled, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 2c21439 41/69: Improve parsing of certain warnings,
Tassilo Horn <=
- [elpa] externals/auctex af1ee52 47/69: Add support for missing macro \SetLabelAlign, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 57147c7 59/69: Another fix for vertical bad box warnings, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex cc59302 51/69: Show and hide warnings and bad boxes in error overview, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 8fac199 14/69: Merge branch 'master' into simplify-TeX-parse-error, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex a2a919d 61/69: Use TeX-quote-after-quote in all language style files, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 188e4b1 66/69: Temporarily bind gc-cons-threshold in time-consuming task, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 2888571 52/69: Allow ignoring certain warnings, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex a33be07 62/69: Remove "table" and "table*" from LaTeX-indent-environment-list, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex e4cad1c 46/69: Add support for Atril viewer, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 464bef6 39/69: Fix TeX-parse-error, Tassilo Horn, 2016/03/26