# HG changeset patch # User Glenn Morris # Date 1190012513 0 # Node ID 7f83f178a5ef5fa62518d0fe34cb2be8b1a0d282 # Parent 2ae770e0113d59b3304f58ebed22bf44df666b43 (tex-compilation-parse-errors): Prefer the filename from `--file-line-error', if it is available. diff -r 2ae770e0113d -r 7f83f178a5ef lisp/textmodes/tex-mode.el --- a/lisp/textmodes/tex-mode.el Mon Sep 17 07:01:41 2007 +0000 +++ b/lisp/textmodes/tex-mode.el Mon Sep 17 07:01:53 2007 +0000 @@ -2011,30 +2011,37 @@ (file-name-directory (buffer-file-name tex-last-buffer-texed))) found-desired (num-errors-found 0) last-filename last-linenum last-position - begin-of-error end-of-error) + begin-of-error end-of-error errfilename) ;; Don't reparse messages already seen at last parse. (goto-char compilation-parsing-end) ;; Parse messages. (while (and (not (or found-desired (eobp))) + ;; First alternative handles the newer --file-line-error style: + ;; ./test2.tex:14: Too many }'s. + ;; Second handles the old-style: + ;; ! Too many }'s. (prog1 (re-search-forward - "^\\(?:[^:\n]+:[[:digit:]]+:\\|!\\) " nil 'move) + "^\\(?:\\([^:\n]+\\):[[:digit:]]+:\\|!\\) " nil 'move) (setq begin-of-error (match-beginning 0) - end-of-error (match-end 0))) + end-of-error (match-end 0) + errfilename (match-string 1))) (re-search-forward "^l\\.\\([0-9]+\\) \\(\\.\\.\\.\\)?\\(.*\\)$" nil 'move)) (let* ((this-error (copy-marker begin-of-error)) (linenum (string-to-number (match-string 1))) (error-text (regexp-quote (match-string 3))) (filename - (save-excursion - (with-syntax-table tex-error-parse-syntax-table - (backward-up-list 1) - (skip-syntax-forward "(_") - (while (not (file-readable-p (thing-at-point 'filename))) - (skip-syntax-backward "(_") - (backward-up-list 1) - (skip-syntax-forward "(_")) - (thing-at-point 'filename)))) + ;; Prefer --file-liner-error filename if we have it. + (or errfilename + (save-excursion + (with-syntax-table tex-error-parse-syntax-table + (backward-up-list 1) + (skip-syntax-forward "(_") + (while (not (file-readable-p (thing-at-point 'filename))) + (skip-syntax-backward "(_") + (backward-up-list 1) + (skip-syntax-forward "(_")) + (thing-at-point 'filename))))) (new-file (or (null last-filename) (not (string-equal last-filename filename))))