Hello,

*Compile-Log* shows a wrong line number for the error in certain cases.

To reproduce, create a file "foo.el" with the content:
 foo

 (byte-compile-file "foo.el") will result in
foo.el:1:2:Warning: reference to free variable `foo'
which is correct.

Now change the file content to:
foo

(byte-compile-file "foo.el") will result in
foo.el:0:1:Warning: reference to free variable `foo'
which is not.


A patch is attached.

regards
Nikolaj Schumacher

--- lisp/emacs-lisp/bytecomp.el	2007-03-11 15:29:29.000000000 +0100
+++ lisp/emacs-lisp/bytecomp.el	2007-03-11 15:29:40.000000000 +0100
@@ -967,21 +967,24 @@
 		      (format "%s:" (file-relative-name byte-compile-current-file dir)))
 		     ((bufferp byte-compile-current-file)
 		      (format "Buffer %s:"
 			      (buffer-name byte-compile-current-file)))
 		     (t "")))
 	 (pos (if (and byte-compile-current-file
 		       (integerp byte-compile-read-position))
 		  (with-current-buffer byte-compile-current-buffer
-		    (format "%d:%d:" (count-lines (point-min)
-						  byte-compile-last-position)
-			    (save-excursion
-			      (goto-char byte-compile-last-position)
-			      (1+ (current-column)))))
+		    (save-excursion
+		      (format "%d:%d:"
+			      (progn
+				(goto-char byte-compile-last-position)
+				(1+ (count-lines (point-min) (point-at-bol))))
+			      (progn
+				(goto-char byte-compile-last-position)
+				(1+ (current-column))))))
 		""))
 	 (form (if (eq byte-compile-current-form :end) "end of data"
 		 (or byte-compile-current-form "toplevel form"))))
     (when (or (and byte-compile-current-file
 		   (not (equal byte-compile-current-file
 			       byte-compile-last-logged-file)))
 	      (and byte-compile-current-form
 		   (not (eq byte-compile-current-form
_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to