comparison lisp/progmodes/compile.el @ 11804:7a7da7fca594

(compilation-next-error-locus): Ignore zero column number. (compilation-parse-errors): Don't store the beginning of the line containing the end of the error-regexp match. Instead, store the beginning of the line containing the start of the match, unless the match starts with a newline, in which case the beginning of the next line.
author Roland McGrath <roland@gnu.org>
date Fri, 12 May 1995 17:26:59 +0000
parents 34dbef732b27
children d8fba932b289
comparison
equal deleted inserted replaced
11803:0e58ab232517 11804:7a7da7fca594
900 900
901 (defun previous-error () 901 (defun previous-error ()
902 "Visit previous compilation error message and corresponding source code. 902 "Visit previous compilation error message and corresponding source code.
903 This operates on the output from the \\[compile] command." 903 This operates on the output from the \\[compile] command."
904 (interactive) 904 (interactive)
905 (next-error '-1)) 905 (next-error -1))
906 906
907 (defun first-error () 907 (defun first-error ()
908 "Reparse the error message buffer and start at the first error 908 "Reparse the error message buffer and start at the first error
909 Visit corresponding source code. 909 Visit corresponding source code.
910 This operates on the output from the \\[compile] command." 910 This operates on the output from the \\[compile] command."
911 (interactive) 911 (interactive)
912 (next-error '(1.1))) 912 (next-error '(4)))
913 913
914 (defun compilation-next-error-locus (&optional move reparse silent) 914 (defun compilation-next-error-locus (&optional move reparse silent)
915 "Visit next compilation error and return locus in corresponding source code. 915 "Visit next compilation error and return locus in corresponding source code.
916 This operates on the output from the \\[compile] command. 916 This operates on the output from the \\[compile] command.
917 If all preparsed error messages have been processed, 917 If all preparsed error messages have been processed,
1035 (- lines)) 1035 (- lines))
1036 (re-search-forward "[\n\C-m]" 1036 (re-search-forward "[\n\C-m]"
1037 nil 'end 1037 nil 'end
1038 lines)) 1038 lines))
1039 (forward-line lines)) 1039 (forward-line lines))
1040 (if column 1040 (if (and column (> column 1))
1041 (move-to-column (1- column))) 1041 (move-to-column (1- column))
1042 (beginning-of-line))
1042 (setq last-line this) 1043 (setq last-line this)
1043 (setcdr (car errors) (point-marker)))) 1044 (setcdr (car errors) (point-marker))))
1044 (setq errors (cdr errors))))))))) 1045 (setq errors (cdr errors)))))))))
1045 ;; If we didn't get a marker for this error, or this 1046 ;; If we didn't get a marker for this error, or this
1046 ;; marker's buffer was killed, go on to the next one. 1047 ;; marker's buffer was killed, go on to the next one.
1075 (widen) 1076 (widen)
1076 (goto-char (cdr next-error)))) 1077 (goto-char (cdr next-error))))
1077 1078
1078 ;; Show compilation buffer in other window, scrolled to this error. 1079 ;; Show compilation buffer in other window, scrolled to this error.
1079 (let* ((pop-up-windows t) 1080 (let* ((pop-up-windows t)
1081 ;; Use an existing window if it is in a visible frame.
1080 (w (or (get-buffer-window (marker-buffer (car next-error)) 'visible) 1082 (w (or (get-buffer-window (marker-buffer (car next-error)) 'visible)
1083 ;; Pop up a window.
1081 (display-buffer (marker-buffer (car next-error)))))) 1084 (display-buffer (marker-buffer (car next-error))))))
1082 (set-window-point w (car next-error)) 1085 (set-window-point w (car next-error))
1083 (set-window-start w (car next-error)) 1086 (set-window-start w (car next-error))
1084 (compilation-set-window-height w))) 1087 (compilation-set-window-height w)))
1085 1088
1342 ;; Locate the erring file and line. 1345 ;; Locate the erring file and line.
1343 ;; Cons a new elt onto compilation-error-list, 1346 ;; Cons a new elt onto compilation-error-list,
1344 ;; giving a marker for the current compilation buffer 1347 ;; giving a marker for the current compilation buffer
1345 ;; location, and the file and line number of the error. 1348 ;; location, and the file and line number of the error.
1346 (save-excursion 1349 (save-excursion
1347 (beginning-of-line 1) 1350 ;; Save as the start of the error the beginning of the
1351 ;; line containing the match unless the match starts at a
1352 ;; newline, in which case the beginning of the next line.
1353 (goto-char beginning-of-match)
1354 (forward-line (if (eolp) 1 0))
1348 (let ((this (cons (point-marker) 1355 (let ((this (cons (point-marker)
1349 (list filename linenum column)))) 1356 (list filename linenum column))))
1350 ;; Don't add the same source line more than once. 1357 ;; Don't add the same source line more than once.
1351 (if (equal (cdr this) (cdr (car compilation-error-list))) 1358 (if (equal (cdr this) (cdr (car compilation-error-list)))
1352 nil 1359 nil