comparison lisp/progmodes/compile.el @ 1294:81c5d1c4a7ed

(compilation-parse-errors): Save (match-beginning 0) in a variable, so the looking-at call doesn't clobber its value when we want to use it to back up before the error we discard. Make sure compilation-error-list is at least two elts long before checking its first two elts for being in the same file.
author Roland McGrath <roland@gnu.org>
date Thu, 01 Oct 1992 02:00:41 +0000
parents bbf7e139412b
children 5af75a1a9a24
comparison
equal deleted inserted replaced
1293:95ae0805ebba 1294:81c5d1c4a7ed
919 (if alist 919 (if alist
920 (setq alist (car alist)) 920 (setq alist (car alist))
921 (error "compilation-parse-errors: Impossible regexp match!")) 921 (error "compilation-parse-errors: Impossible regexp match!"))
922 922
923 ;; Extract the file name and line number from the error message. 923 ;; Extract the file name and line number from the error message.
924 (let ((filename 924 (let ((beginning-of-match (match-beginning 0)) ;looking-at nukes
925 (filename
925 (cons default-directory 926 (cons default-directory
926 (buffer-substring (match-beginning (nth 1 alist)) 927 (buffer-substring (match-beginning (nth 1 alist))
927 (match-end (nth 1 alist))))) 928 (match-end (nth 1 alist)))))
928 (linenum (save-restriction 929 (linenum (save-restriction
929 (narrow-to-region 930 (narrow-to-region
939 (save-excursion 940 (save-excursion
940 (beginning-of-line 1) 941 (beginning-of-line 1)
941 (setq compilation-error-list 942 (setq compilation-error-list
942 (cons (cons (point-marker) 943 (cons (cons (point-marker)
943 (cons filename linenum)) 944 (cons filename linenum))
944 compilation-error-list)))) 945 compilation-error-list)))
945 (setq compilation-num-errors-found 946 (setq compilation-num-errors-found
946 (1+ compilation-num-errors-found)) 947 (1+ compilation-num-errors-found))
947 (and find-at-least (>= compilation-num-errors-found find-at-least) 948 (and find-at-least (>= compilation-num-errors-found
948 ;; We have found as many new errors as the user wants. 949 find-at-least)
949 ;; We continue to parse until we have seen all 950 ;; We have found as many new errors as the user wants.
950 ;; the consecutive errors in the same file, 951 ;; We continue to parse until we have seen all
951 ;; so the error positions will be recorded as markers 952 ;; the consecutive errors in the same file,
952 ;; in this buffer that might change. 953 ;; so the error positions will be recorded as markers
953 (not (equal (car (cdr (nth 0 compilation-error-list))) 954 ;; in this buffer that might change.
954 (car (cdr (nth 1 compilation-error-list))))) 955 (cdr compilation-error-list) ; Must check at least two.
955 (progn 956 (not (equal (car (cdr (nth 0 compilation-error-list)))
956 ;; Discard the error just parsed, so that the next 957 (car (cdr (nth 1 compilation-error-list)))))
957 ;; parsing run can get it and the following errors in 958 (progn
958 ;; the same file all at once. If we didn't do this, we 959 ;; Discard the error just parsed, so that the next
959 ;; would have the same problem we are trying to avoid 960 ;; parsing run can get it and the following errors in
960 ;; with the test above, just delayed until the next run! 961 ;; the same file all at once. If we didn't do this, we
961 (setq compilation-error-list (cdr compilation-error-list)) 962 ;; would have the same problem we are trying to avoid
962 (goto-char (match-beginning 0)) 963 ;; with the test above, just delayed until the next run!
963 (setq found-desired t))) 964 (setq compilation-error-list
965 (cdr compilation-error-list))
966 (goto-char beginning-of-match)
967 (setq found-desired t)))
968 )
964 ) 969 )
965 (t 970 (t
966 (error "compilation-parse-errors: impossible regexp match!"))) 971 (error "compilation-parse-errors: impossible regexp match!")))
967 972
968 (message "Parsing error messages...%d (%d%% of buffer)" 973 (message "Parsing error messages...%d (%d%% of buffer)"