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. 464bef63b52ef3aee0b50


From: Mosè Giordano
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 464bef63b52ef3aee0b50c4bee76d24dc6b58ddc
Date: Sun, 07 Feb 2016 17:01:05 +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  464bef63b52ef3aee0b50c4bee76d24dc6b58ddc (commit)
       via  891bba7c125e7fff5e0c345e5aab1a28a809902e (commit)
      from  d7f443e5c9237cef9c0392738877cd5d6a093fe0 (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 464bef63b52ef3aee0b50c4bee76d24dc6b58ddc
Author: Mosè Giordano <address@hidden>
Date:   Sun Feb 7 17:58:49 2016 +0100

    Fix TeX-parse-error
    
    * tex-buf.el (TeX-parse-error): Remove from the file string pages of the
      output file.
    * tests/tex/compilation-log.txt: Add a warning containing such faulty
      file name.
    * tests/tex/error-parsing.el (TeX-error-parsing): Update result of the
      test accordingly.

diff --git a/tests/tex/compilation-log.txt b/tests/tex/compilation-log.txt
index f28dbf1..98b3422 100644
--- a/tests/tex/compilation-log.txt
+++ b/tests/tex/compilation-log.txt
@@ -5,4 +5,9 @@
 
 Package foo Warning: This is a warning!
 
-[1{/opt/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] 
(./test.aux))
+[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]))
diff --git a/tests/tex/error-parsing.el b/tests/tex/error-parsing.el
index aa01629..ce09750 100644
--- a/tests/tex/error-parsing.el
+++ b/tests/tex/error-parsing.el
@@ -44,12 +44,18 @@ command line and from another directory."
   "Test error parsing functions."
   (should (equal
           (with-temp-buffer
-            (setq TeX-debug-warnings t)
+            (setq TeX-debug-warnings t
+                  TeX-debug-bad-boxes t)
              (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)))))
+                     nil nil nil 170)
+            (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)))))
 
 ;;; error-parsing.el ends here
diff --git a/tex-buf.el b/tex-buf.el
index 3478590..d44cbc7 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -2319,11 +2319,23 @@ Return non-nil if an error or warning is found."
            (when (or (eq (string-to-char file) ?\")
                      (string-match "[ \t\n]" file))
              (setq file (mapconcat 'identity (split-string file "[\"\n]+") 
"")))
-           ;; Trim whitespace at the front/end
+           ;; Polish `file' string
            (setq file
-                 (progn
-                   (string-match 
"^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" file)
-                   (match-string 1 file)))
+                 (let ((string file))
+                   ;; Trim whitespaces at the front.  XXX: XEmacs doesn't
+                   ;; support character classes in regexps, like "[:space:]".
+                   (setq string
+                         (if (string-match "\\'[ \t\n\r]*" string)
+                             (replace-match "" t t string)
+                           string))
+                   ;; Sometimes `file' is something like
+                   ;;     "./path/to/file.tex [9] [10] "
+                   ;; where "[9]" and "[10]" are pages of the output file.
+                   ;; Remove these numbers together with whitespaces at the end
+                   ;; of the string.
+                   (if (string-match "\\( *\\(\\[[0-9]+\\]\\)? *\\)*\\'" 
string)
+                       (replace-match "" t t string)
+                     string)))
            (push file TeX-error-file)
            (push nil TeX-error-offset)
            (goto-char end))

commit 891bba7c125e7fff5e0c345e5aab1a28a809902e
Author: Mosè Giordano <address@hidden>
Date:   Sun Feb 7 15:13:48 2016 +0100

    Add ERT test for error parsing
    
    * tests/tex/compilation-log.txt: Add minimal example of compilation log
      that failed to be parsed correctly with the old parsing function.
    * tests/tex/error-parsing.el: New ERT test.

diff --git a/tests/tex/compilation-log.txt b/tests/tex/compilation-log.txt
new file mode 100644
index 0000000..f28dbf1
--- /dev/null
+++ b/tests/tex/compilation-log.txt
@@ -0,0 +1,8 @@
+(./test.tex
+(/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!
+
+[1{/opt/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] 
(./test.aux))
diff --git a/tests/tex/error-parsing.el b/tests/tex/error-parsing.el
new file mode 100644
index 0000000..aa01629
--- /dev/null
+++ b/tests/tex/error-parsing.el
@@ -0,0 +1,55 @@
+;;; error-parsing.el --- tests for error parsing
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Code:
+
+(require 'ert)
+(require 'tex-buf)
+
+(defun AUCTeX-set-ert-path (&rest sym-val)
+  "Set first element of SYM-VAL to the next one, and so on.
+
+The value is the path to the test file, make sure it is expanded
+in the right directory even when the ERT test is run from the
+command line and from another directory."
+  (while sym-val
+    (set (pop sym-val)
+        (expand-file-name (pop sym-val)
+                          (when load-file-name
+                            (file-name-directory load-file-name))))))
+
+(AUCTeX-set-ert-path
+ 'TeX-test-compilation-log
+ "compilation-log.txt")
+
+(ert-deftest TeX-error-parsing ()
+  "Test error parsing functions."
+  (should (equal
+          (with-temp-buffer
+            (setq TeX-debug-warnings t)
+             (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)))))
+
+;;; error-parsing.el ends here

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

Summary of changes:
 tests/tex/compilation-log.txt |   13 +++++++++
 tests/tex/error-parsing.el    |   61 +++++++++++++++++++++++++++++++++++++++++
 tex-buf.el                    |   20 +++++++++++---
 3 files changed, 90 insertions(+), 4 deletions(-)
 create mode 100644 tests/tex/compilation-log.txt
 create mode 100644 tests/tex/error-parsing.el


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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