comparison lisp/textmodes/tex-mode.el @ 84620:71ee9cbb96e8

(tex-compilation-parse-errors): Prefer the filename from `--file-line-error', if it is available.
author Glenn Morris <rgm@gnu.org>
date Mon, 17 Sep 2007 07:04:46 +0000
parents bb15bcc10f4b
children 2b86b3a54870
comparison
equal deleted inserted replaced
84619:d400c4ec2e2b 84620:71ee9cbb96e8
2030 (setq compilation-error-list nil) 2030 (setq compilation-error-list nil)
2031 (let ((default-directory ; Perhaps dir has changed meanwhile. 2031 (let ((default-directory ; Perhaps dir has changed meanwhile.
2032 (file-name-directory (buffer-file-name tex-last-buffer-texed))) 2032 (file-name-directory (buffer-file-name tex-last-buffer-texed)))
2033 found-desired (num-errors-found 0) 2033 found-desired (num-errors-found 0)
2034 last-filename last-linenum last-position 2034 last-filename last-linenum last-position
2035 begin-of-error end-of-error) 2035 begin-of-error end-of-error errfilename)
2036 ;; Don't reparse messages already seen at last parse. 2036 ;; Don't reparse messages already seen at last parse.
2037 (goto-char compilation-parsing-end) 2037 (goto-char compilation-parsing-end)
2038 ;; Parse messages. 2038 ;; Parse messages.
2039 (while (and (not (or found-desired (eobp))) 2039 (while (and (not (or found-desired (eobp)))
2040 ;; First alternative handles the newer --file-line-error style:
2041 ;; ./test2.tex:14: Too many }'s.
2042 ;; Second handles the old-style:
2043 ;; ! Too many }'s.
2040 (prog1 (re-search-forward 2044 (prog1 (re-search-forward
2041 "^\\(?:[^:\n]+:[[:digit:]]+:\\|!\\) " nil 'move) 2045 "^\\(?:\\([^:\n]+\\):[[:digit:]]+:\\|!\\) " nil 'move)
2042 (setq begin-of-error (match-beginning 0) 2046 (setq begin-of-error (match-beginning 0)
2043 end-of-error (match-end 0))) 2047 end-of-error (match-end 0)
2048 errfilename (match-string 1)))
2044 (re-search-forward 2049 (re-search-forward
2045 "^l\\.\\([0-9]+\\) \\(\\.\\.\\.\\)?\\(.*\\)$" nil 'move)) 2050 "^l\\.\\([0-9]+\\) \\(\\.\\.\\.\\)?\\(.*\\)$" nil 'move))
2046 (let* ((this-error (copy-marker begin-of-error)) 2051 (let* ((this-error (copy-marker begin-of-error))
2047 (linenum (string-to-number (match-string 1))) 2052 (linenum (string-to-number (match-string 1)))
2048 (error-text (regexp-quote (match-string 3))) 2053 (error-text (regexp-quote (match-string 3)))
2049 (filename 2054 (filename
2050 (save-excursion 2055 ;; Prefer --file-liner-error filename if we have it.
2051 (with-syntax-table tex-error-parse-syntax-table 2056 (or errfilename
2052 (backward-up-list 1) 2057 (save-excursion
2053 (skip-syntax-forward "(_") 2058 (with-syntax-table tex-error-parse-syntax-table
2054 (while (not (file-readable-p (thing-at-point 'filename))) 2059 (backward-up-list 1)
2055 (skip-syntax-backward "(_") 2060 (skip-syntax-forward "(_")
2056 (backward-up-list 1) 2061 (while (not (file-readable-p (thing-at-point 'filename)))
2057 (skip-syntax-forward "(_")) 2062 (skip-syntax-backward "(_")
2058 (thing-at-point 'filename)))) 2063 (backward-up-list 1)
2064 (skip-syntax-forward "(_"))
2065 (thing-at-point 'filename)))))
2059 (new-file 2066 (new-file
2060 (or (null last-filename) 2067 (or (null last-filename)
2061 (not (string-equal last-filename filename)))) 2068 (not (string-equal last-filename filename))))
2062 (error-location 2069 (error-location
2063 (with-current-buffer 2070 (with-current-buffer