changeset 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 95ae0805ebba
children a9241dc503ab
files lisp/progmodes/compile.el
diffstat 1 files changed, 26 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/compile.el	Thu Oct 01 01:58:57 1992 +0000
+++ b/lisp/progmodes/compile.el	Thu Oct 01 02:00:41 1992 +0000
@@ -921,7 +921,8 @@
 	       (error "compilation-parse-errors: Impossible regexp match!"))
 	     
 	     ;; Extract the file name and line number from the error message.
-	     (let ((filename
+	     (let ((beginning-of-match (match-beginning 0)) ;looking-at nukes
+		   (filename
 		    (cons default-directory
 			  (buffer-substring (match-beginning (nth 1 alist))
 					    (match-end (nth 1 alist)))))
@@ -941,26 +942,30 @@
 		 (setq compilation-error-list
 		       (cons (cons (point-marker)
 				   (cons filename linenum))
-			     compilation-error-list))))
-	     (setq compilation-num-errors-found
-		   (1+ compilation-num-errors-found))
-	     (and find-at-least (>= compilation-num-errors-found find-at-least)
-		  ;; We have found as many new errors as the user wants.
-		  ;; We continue to parse until we have seen all
-		  ;; the consecutive errors in the same file,
-		  ;; so the error positions will be recorded as markers
-		  ;; in this buffer that might change.
-		  (not (equal (car (cdr (nth 0 compilation-error-list)))
-			      (car (cdr (nth 1 compilation-error-list)))))
-		  (progn
-		    ;; Discard the error just parsed, so that the next
-		    ;; parsing run can get it and the following errors in
-		    ;; the same file all at once.  If we didn't do this, we
-		    ;; would have the same problem we are trying to avoid
-		    ;; with the test above, just delayed until the next run!
-		    (setq compilation-error-list (cdr compilation-error-list))
-		    (goto-char (match-beginning 0))
-		    (setq found-desired t)))
+			     compilation-error-list)))
+	       (setq compilation-num-errors-found
+		     (1+ compilation-num-errors-found))
+	       (and find-at-least (>= compilation-num-errors-found
+				      find-at-least)
+		    ;; We have found as many new errors as the user wants.
+		    ;; We continue to parse until we have seen all
+		    ;; the consecutive errors in the same file,
+		    ;; so the error positions will be recorded as markers
+		    ;; in this buffer that might change.
+		    (cdr compilation-error-list) ; Must check at least two.
+		    (not (equal (car (cdr (nth 0 compilation-error-list)))
+				(car (cdr (nth 1 compilation-error-list)))))
+		    (progn
+		      ;; Discard the error just parsed, so that the next
+		      ;; parsing run can get it and the following errors in
+		      ;; the same file all at once.  If we didn't do this, we
+		      ;; would have the same problem we are trying to avoid
+		      ;; with the test above, just delayed until the next run!
+		      (setq compilation-error-list
+			    (cdr compilation-error-list))
+		      (goto-char beginning-of-match)
+		      (setq found-desired t)))
+	       )
 	     )
 	    (t
 	     (error "compilation-parse-errors: impossible regexp match!")))