GNU bug report logs - #22288
25.0.50; Incorrect line and column number in byte-compilation warning

Previous Next

Package: emacs;

Reported by: Clément Pit--Claudel <clement.pitclaudel <at> live.com>

Date: Sat, 2 Jan 2016 01:52:04 UTC

Severity: minor

Merged with 2681, 8774, 9109, 24128, 24592

Found in versions 23.0.91, 23.3.1, 24.0.50, 24.3.1, 25.0.50, 25.1

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Alan Mackenzie <acm <at> muc.de>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#8774: closed (incorrect line numbers from byte-compile-file)
Date: Sat, 22 Jan 2022 18:18:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 22 Jan 2022 18:16:58 +0000
with message-id <YexKGvOcfTMQtFJD <at> ACM>
and subject line Re: bug#22288: 25.0.50; Incorrect line and column number in byte-compilation warning
has caused the debbugs.gnu.org bug report #22288,
regarding incorrect line numbers from byte-compile-file
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
22288: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22288
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stephen Eglen <S.J.Eglen <at> damtp.cam.ac.uk>
To: bug-gnu-emacs <at> gnu.org
Cc: Stephen Eglen <S.J.Eglen <at> damtp.cam.ac.uk>
Subject: incorrect line numbers from byte-compile-file
Date: Tue, 31 May 2011 15:33:21 +0100
With emacs -q, load the following into a file, test.el
----------------------------------------------------------------------
(defun fix-page-breaks ()
  "Fix page breaks in SAS 6 print files."
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (if (looking-at "\f") (delete-char 1))
    (replace-regexp "^\\(.+\\)\f" "\\1\n\f\n")
    (goto-char (point-min))
    (replace-regexp "^\f\\(.+\\)" "\f\n\\1")
    (goto-char (point-min))))


----------------------------------------------------------------------

then M-x byte-compile-file generates:

Compiling file /Users/stephen/txt/t/test.el at Tue May 31 15:28:08 2011

In fix-page-breaks:
test.el:6:28:Warning: `replace-regexp' used from Lisp code
That command is designed for interactive use only
test.el:7:6:Warning: `replace-regexp' used from Lisp code
That command is designed for interactive use only

The first error has the wrong line, although it has caught the two
problematic cases.

This is with emacs 23.3.1, but same behaviour seen on Emacs 24.0.50

Stephen

(emacs-version)
"GNU Emacs 23.3.1 (x86_64-apple-darwin10.6.0, NS apple-appkit-1038.35)
 of 2011-03-10 on teva.local"


[Message part 3 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Cc: 22288-done <at> debbugs.gnu.org
Subject: Re: bug#22288: 25.0.50; Incorrect line and column number in
 byte-compilation warning
Date: Sat, 22 Jan 2022 18:16:58 +0000
Hello Everybody.

This bug has just been fixed in master by merging in branch
scratch/correct-warning-pos.

-- 
Alan Mackenzie (Nuremberg, Germany).

On Fri, Jan 01, 2016 at 10:54:24 -0500, Clément Pit--Claudel wrote:
> Hi all,

> The byte-compiler doesn't always report the right line and column numbers. For example for the following program in test.el:

> (defun test ()
>   (let (a))
>   a)

> Running M-x byte-compile-file RET test.el RET yields:

> > Compiling file /home/clement/test.el at Fri Jan  1 10:48:41 2016

> > In test:
> > test.el:2:9:Warning: reference to free variable ‘a’

> The correct warning would be

> > test.el:3:2:Warning: reference to free variable ‘a’

> Note that the following program gives the right error:

> (defun test ()
>   (let (b))
>   a)

> > test.el:3:3:Warning: reference to free variable ‘a’

> Although one might argue that it should be

> > test.el:3:2:Warning: reference to free variable ‘a’

> (that is, column 2, not 3) given that Emacs starts counting columns at 0.

> Cheers,
> Clément.

> In GNU Emacs 25.0.50.8 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
>  of 2015-12-29 built on clem-w50-mint
> Repository revision: a21bb238ce7bcc9c13a9cf66db77918304daa2fc
> Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
> System Description:	Linux Mint 17.2 Rafaela


This bug report was last modified 3 years and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.