branch: externals/auctex commit 464bef63b52ef3aee0b50c4bee76d24dc6b58ddc Author: Mosè Giordano <m...@gnu.org> Commit: Mosè Giordano <m...@gnu.org>
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. --- tests/tex/compilation-log.txt | 7 ++++++- tests/tex/error-parsing.el | 10 ++++++++-- tex-buf.el | 20 ++++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) 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))