[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-devel] [elpa] externals/auctex 2c21439 41/69: Improve parsing of
From: |
Tassilo Horn |
Subject: |
[AUCTeX-devel] [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 egin{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!
"
- 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.
"
+ nil 32 nil 376)
+ (error
+ "./test.tex" 2
+ "Class nice-class Error: ***********************************" 0
+ "
(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}
(/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.
"
+ nil 3 nil 1030)
(bad-box
"./secondary-file.tex" 131
"Underfull \hbox (badness 6608) in paragraph at lines 131--132"
0 "
[]|\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.
"
+ "wrong" 4 nil 1334)
+ (warning "./test.tex" 4 "LaTeX Warning: There were undefined
references."
+ 0 "LaTeX Warning: There were undefined references.
" 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))
- [AUCTeX-devel] [elpa] externals/auctex d4059b8 02/69: Improve line wrap removal heuristics., (continued)
- [AUCTeX-devel] [elpa] externals/auctex d4059b8 02/69: Improve line wrap removal heuristics., Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex f1bcbe3 54/69: Improve LaTeX-warnings-regexp, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 0731fff 10/69: Merge branch 'master' into simplify-TeX-parse-error, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 8926369 06/69: Improve new-file regex., Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex f7d0535 34/69: Fix file name regexp in TeX-documentation-texdoc, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex c09c405 48/69: Fix wrong usage of `TeX-auto-prepare-hook', Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 7d4bfac 18/69: Merge branch 'master' into simplify-TeX-parse-error, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 2cca33f 42/69: Minor fix in TeX-documentation-texdoc, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex a1473f7 33/69: Capture warnings from packages with hyphens in name, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 4837aba 26/69: Merge branch 'master' into simplify-TeX-parse-error, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 2c21439 41/69: Improve parsing of certain warnings,
Tassilo Horn <=
- [AUCTeX-devel] [elpa] externals/auctex 08ae29b 19/69: Merge branch 'master' into simplify-TeX-parse-error, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex b72dcb7 44/69: Add support for SumatraPDF viewer, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 2888571 52/69: Allow ignoring certain warnings, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 16f3dd4 43/69: Add support for Zathura viewer, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex cfa82d8 65/69: Prompt for optional short caption parameter., Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 2e543ef 58/69: Fix parsing of vertical bad boxes context, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 891bba7 38/69: Add ERT test for error parsing, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex 4357488 68/69: Merge branch 'master' into elpa, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex fd46872 25/69: Merge branch 'master' into simplify-TeX-parse-error, Tassilo Horn, 2016/03/26
- [AUCTeX-devel] [elpa] externals/auctex f9efa73 35/69: Another fix for file name regexp in TeX-documentation-texdoc, Tassilo Horn, 2016/03/26