[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 70e62a9 57/69: Catch more bad box warnings
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 70e62a9 57/69: Catch more bad box warnings |
Date: |
Sat, 26 Mar 2016 21:36:37 +0000 |
branch: externals/auctex
commit 70e62a98cac5882e7e4c5c2c7cb719adbb48fdd2
Author: Mosè Giordano <address@hidden>
Commit: Mosè Giordano <address@hidden>
Catch more bad box warnings
* tex-buf.el (TeX-error-list): More information for some elements of the
list.
(TeX-parse-error): Change regexp to catch bad vertical boxes as well and
provide new argument to `TeX-warning'.
(TeX-warning): Require an additional mandatory argument, `bad-box'.
Improve regexp for detecting ending line of horizontal bad boxes in
order to cater for the case "...at line NN".
* tests/tex/error-parsing.el: Update result of the test.
---
tests/tex/error-parsing.el | 2 +-
tex-buf.el | 35 +++++++++++++++++++++--------------
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/tests/tex/error-parsing.el b/tests/tex/error-parsing.el
index 6251847..979059b 100644
--- a/tests/tex/error-parsing.el
+++ b/tests/tex/error-parsing.el
@@ -81,7 +81,7 @@ ABD: EveryShipout initializing macros"
"./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 1268 nil)
+ 132 t 1268 nil)
(warning "./test.tex" 4
"LaTeX Warning: Reference `wrong' on page 1 undefined on input
line 4."
0
diff --git a/tex-buf.el b/tex-buf.el
index c2ba9f8..052f414 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -2277,11 +2277,12 @@ error or warning. This is the structure of each
element:
* 2: line
* 3: message of the error or warning
* 4: offset
- * 5: context
- * 6: string
+ * 5: context, to be displayed in the help window
+ * 6: string to search in the buffer, in order to find location
+ of the error or warning
* 7: for warnings referring to multiple lines (e.g. bad boxes),
the last line mentioned in the warning message
- * 8: bad-box
+ * 8: t if it is a bad-box, nil otherwise
* 9: value of `TeX-error-point'
* 10: whether the warning should be ignored
@@ -2329,7 +2330,7 @@ Return non-nil if an error or warning is found."
"name(\\([^)]+\\))\\)\\|"
;; LaTeX bad box
"^\\(\\(?:Overfull\\|Underfull\\|Tight\\|Loose\\)\
- \\\\.*?[0-9]+--[0-9]+\\)\\|"
+ \\\\[hv]box.*\\)\\|"
;; LaTeX warning
"^\\(" LaTeX-warnings-regexp ".*\\)"))
(error-found nil))
@@ -2363,7 +2364,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) (match-beginning 7) store)
+ (TeX-warning (TeX-match-buffer 7) (match-beginning 7) t store)
nil)
(re-search-forward "\r?\n\
\\(?:.\\{79\\}\r?\n\
@@ -2376,7 +2377,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) (match-beginning 8) store)
+ (TeX-warning (TeX-match-buffer 8) (match-beginning 8) nil store)
nil)
t))
@@ -2553,19 +2554,20 @@ 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 warning-start &optional store)
+(defun TeX-warning (warning warning-start bad-box &optional store)
"Display a warning for WARNING.
-WARNING-START is the position where WARNING starts.
+WARNING-START is the position where WARNING starts. If BAD-BOX
+is non-nil, the warning refers to a bad-box, otherwise it is a
+generic warning.
If optional argument STORE is non-nil, store the warning
information in `TeX-error-list' instead of displaying the
warning."
- (let* ( ;; bad-box is nil if this is a "LaTeX Warning"
- (bad-box (string-match "\\\\[vh]box.*[0-9]*--[0-9]*" warning))
- ;; line-string: match 1 is beginning line, match 2 is end line
- (line-string (if bad-box " \\([0-9]*\\)--\\([0-9]*\\)"
+ (let* ( ;; line-string: match 1 is beginning line, match 2 is end line
+ (line-string (if bad-box
+ "at lines? \\([0-9]*\\)\\(?:--\\([0-9]*\\)\\)?"
"on input line \\([0-9]*\\)\\."))
;; word-string: match 1 is the word
(word-string (if bad-box "[][\\W() ---]\\(\\w+\\)[][\\W() ---]*$"
@@ -2576,7 +2578,11 @@ warning."
(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))
+ ;; If this is a bad box and the warning ends with "...at lines MM--NN"
+ ;; we can use "NN" as `line-end', in any other case (including bad
+ ;; boxes ending with "...at line NN") just use `line'.
+ (line-end (if (and bad-box (match-beginning 2))
+ (string-to-number (TeX-match-buffer 2))
line))
;; Find the context
@@ -2625,7 +2631,8 @@ warning."
(and (null line)
(string-match line-string context)
(setq line-end
- (setq line (string-to-number (match-string 1 context)))))
+ (setq line (and (match-beginning 1)
+ (string-to-number (match-string 1 context))))))
;; This is where we start next time.
(goto-char error-point)
- [elpa] externals/auctex 8fac199 14/69: Merge branch 'master' into simplify-TeX-parse-error, (continued)
- [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
- [elpa] externals/auctex 00d9438 45/69: Add support for dviout viewer, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex d4b0d5f 67/69: Fix forward sync bug with multi-file documents, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex b88dc70 64/69: Improve prompts when defining LaTeX macros., Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 70e62a9 57/69: Catch more bad box warnings,
Tassilo Horn <=
- [elpa] externals/auctex 16f3dd4 43/69: Add support for Zathura viewer, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex bfd5f18 09/69: Merge master branch., Tassilo Horn, 2016/03/26
- [elpa] externals/auctex cfa82d8 65/69: Prompt for optional short caption parameter., Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 550e058 49/69: Add new style/splitidx.el, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex f1abcf8 69/69: Upgrade docs for release, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 8683935 27/69: Merge branch 'master' into simplify-TeX-parse-error, Tassilo Horn, 2016/03/26
- [elpa] externals/auctex 4357488 68/69: Merge branch 'master' into elpa, Tassilo Horn, 2016/03/26