auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 2e543efcc625e2e8645c9


From: Mosè Giordano
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 2e543efcc625e2e8645c934e01d3baf76b104bee
Date: Fri, 26 Feb 2016 09:18:39 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  2e543efcc625e2e8645c934e01d3baf76b104bee (commit)
       via  70e62a98cac5882e7e4c5c2c7cb719adbb48fdd2 (commit)
      from  6962c34a28dbf62622f46fbeca77295223c3112c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2e543efcc625e2e8645c934e01d3baf76b104bee
Author: Mosè Giordano <address@hidden>
Date:   Fri Feb 26 10:07:51 2016 +0100

    Fix parsing of vertical bad boxes context
    
    * tex-buf.el (TeX-warning): Use as context for vertical bad boxes the
    warning itself and don't move point.
    * tests/tex/compilation-log.txt: Add a test for vertical bad boxes, and
    horizontal bad boxes ending with "at line NN".  The two warnings are in
    two consecutive lines, make sure the second one is correctly reported.
    * tests/tex/error-parsing.el: Update result of the test accordingly.

diff --git a/tests/tex/compilation-log.txt b/tests/tex/compilation-log.txt
index 2e8e00f..3598af4 100644
--- a/tests/tex/compilation-log.txt
+++ b/tests/tex/compilation-log.txt
@@ -41,6 +41,12 @@ LaTeX Font Warning: Font shape `OML/cmm/b/it' in size <5.5> 
not available
 
 [1{/opt/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] 
(./test.aux)
 
+(./test.lof
+Underfull \vbox (badness 1048) has occurred while \output is active [7]
+Overfull \hbox (0.93071pt too wide) detected at line 31
+ []\T1/jkpl/m/n/10.95 144
+)
+
 LaTeX Warning: There were undefined references.
 
 )
diff --git a/tests/tex/error-parsing.el b/tests/tex/error-parsing.el
index 979059b..170c8bf 100644
--- a/tests/tex/error-parsing.el
+++ b/tests/tex/error-parsing.el
@@ -90,7 +90,17 @@ ABD: EveryShipout initializing macros"
              (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.\n" nil 70 nil 1485 
nil)
+             (bad-box "./test.lof" nil "Underfull \\vbox (badness 1048) has 
occurred while \\output is active [7]"
+              0 "\nUnderfull \\vbox (badness 1048) has occurred while \\output 
is active [7]"
+              nil nil t 1651 nil)
+             ;; It is possible there are two different bad box warnings in two
+             ;; consecutive lines (for example it happens if the first one is a
+             ;; vertical bad box which doesn't provide additional information),
+             ;; this test makes sure the second warning is not mistaken as
+             ;; context of the first one.
+             (bad-box "./test.lof" 31 "Overfull \\hbox (0.93071pt too wide) 
detected at line 31"
+              0 "\n []\\T1/jkpl/m/n/10.95 144" "144" 31 t 1733 nil)
              (warning "./test.tex" nil "LaTeX Warning: There were undefined 
references."
-              0 "LaTeX Warning: There were undefined references.\n" nil nil 
nil 1616 nil)))))
+              0 "LaTeX Warning: There were undefined references.\n" nil nil 
nil 1785 nil)))))
 
 ;;; error-parsing.el ends here
diff --git a/tex-buf.el b/tex-buf.el
index 052f414..15e9a69 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -2590,24 +2590,34 @@ warning."
                                 (beginning-of-line))
                               (point)))
 
-        (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)
-                     (forward-line 1)
-                     (end-of-line))
-                   (buffer-substring context-start (point))))
+        (context (cond ((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.
+                        (beginning-of-line)
+                        (while (null (eolp))
+                          (forward-line 1))
+                        (buffer-substring context-start (progn (end-of-line)
+                                                               (point))))
+
+                       ((and bad-box (string-match "\\\\vbox" warning))
+                       ;; Vertical bad boxes don't provide any additional
+                       ;; information.  In this case, reuse the `warning' as
+                       ;; `context' and don't move point, so that we avoid
+                       ;; eating the next line that may contain another
+                       ;; warning.
+                        (concat "\n" warning))
+
+                       (t
+                        ;; Horizontal bad boxes.
+                        (forward-line 1)
+                        (end-of-line)
+                        (while (equal (current-column) 79)
+                          (forward-line 1)
+                          (end-of-line))
+                        (buffer-substring context-start (point)))))
 
         ;; This is where we want to be.
         (error-point (point))

commit 70e62a98cac5882e7e4c5c2c7cb719adbb48fdd2
Author: Mosè Giordano <address@hidden>
Date:   Fri Feb 26 09:44:36 2016 +0100

    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.

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)

-----------------------------------------------------------------------

Summary of changes:
 tests/tex/compilation-log.txt |    6 +++
 tests/tex/error-parsing.el    |   14 ++++++-
 tex-buf.el                    |   81 +++++++++++++++++++++++++----------------
 3 files changed, 67 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

[Prev in Thread] Current Thread [Next in Thread]