GNU bug report logs - #11904
24.1.50; error byte compiling (defvar :foo ':foo), regression from 23.4

Previous Next

Package: emacs;

Reported by: Michael Welsh Duggan <md5i <at> md5i.com>

Date: Tue, 10 Jul 2012 23:23:01 UTC

Severity: normal

Found in version 24.1.50

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11904 in the body.
You can then email your comments to 11904 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11904; Package emacs. (Tue, 10 Jul 2012 23:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Welsh Duggan <md5i <at> md5i.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 10 Jul 2012 23:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Welsh Duggan <md5i <at> md5i.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1.50;
	error byte compiling (defvar :foo ':foo), regression from 23.4
Date: Tue, 10 Jul 2012 19:16:47 -0400
[Message part 1 (text/plain, inline)]
Create a new directory and within this directory create the following
two files:

File foo.el:
[foo.el (application/emacs-lisp, inline)]
[Message part 3 (text/plain, inline)]
File bar.el:
[bar.el (application/emacs-lisp, inline)]
[Message part 5 (text/plain, inline)]
From within that directory, run the following command:

  emacs --no-site-file --no-init-file --batch --eval='(setq load-path (cons "." load-path) )' -f batch-byte-compile *.el

Then, again run the same command:

  emacs --no-site-file --no-init-file --batch --eval='(setq load-path (cons "." load-path) )' -f batch-byte-compile *.el

This first time around, both files complain without error.  The second
time I get the following error:

  In toplevel form:
  bar.el:1:1:Error: Constant symbol `:foo' specified in defvar
  Wrote /tmp/baz/foo.elc

I have verified that this is a regression from emacs 23.4.



In GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, X toolkit)
 of 2012-07-09 on maru
Bzr revision: 108966 rgm <at> gnu.org-20120709101737-t80gis1iw52odbif
Windowing system distributor `The X.Org Foundation', version 11.0.11201902
Configured using:
 `configure '--without-gconf' '--without-gsettings'
 '--without-toolkit-scroll-bars' '--with-x-toolkit=lucid' 'CFLAGS=-O0
 -ggdb' '--enable-asserts' '--with-wide-int' '--enable-maintainer-mode''

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

-- 
Michael Welsh Duggan
(md5i <at> md5i.com)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11904; Package emacs. (Wed, 11 Jul 2012 07:45:02 GMT) Full text and rfc822 format available.

Message #8 received at 11904 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Michael Welsh Duggan <md5i <at> md5i.com>
Cc: 11904 <at> debbugs.gnu.org
Subject: Re: bug#11904: 24.1.50;
	error byte compiling (defvar :foo ':foo), regression from 23.4
Date: Wed, 11 Jul 2012 09:38:33 +0200
That's because (defvar :foo ':foo) is written as (defvar :foo :foo) in
the elc file, which defvar doesn't allow.  byte-compile-file-form-defvar
no longer calls byte-compile-form via byte-compile-keep-pending which
would handle it correctly (and emit a warning).  When adding a doc
string the bug also happens in emacs < 24.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11904; Package emacs. (Thu, 12 Jul 2012 13:49:01 GMT) Full text and rfc822 format available.

Message #11 received at 11904 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Michael Welsh Duggan <md5i <at> md5i.com>
Cc: 11904 <at> debbugs.gnu.org
Subject: Re: bug#11904: 24.1.50;
	error byte compiling (defvar :foo ':foo), regression from 23.4
Date: Thu, 12 Jul 2012 09:43:18 -0400
> (defvar :foo ':foo)

I'm curious: where did you find such code?
Such code used to be added "implicitly" back in Emacs-19 days because
Emacs-19 did not have keywords.  Some packages kept such code a bit
longer in the hope that the resulting code would still work under
Emacs-19, but nowadays this seems very outdated.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11904; Package emacs. (Thu, 12 Jul 2012 13:58:01 GMT) Full text and rfc822 format available.

Message #14 received at 11904 <at> debbugs.gnu.org (full text, mbox):

From: Michael Welsh Duggan <mwd <at> cert.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Michael Welsh Duggan <md5i <at> md5i.com>, 11904 <at> debbugs.gnu.org
Subject: Re: bug#11904: 24.1.50;
	error byte compiling (defvar :foo ':foo), regression from 23.4
Date: Thu, 12 Jul 2012 09:52:15 -0400
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>> (defvar :foo ':foo)
>
> I'm curious: where did you find such code?
> Such code used to be added "implicitly" back in Emacs-19 days because
> Emacs-19 did not have keywords.  Some packages kept such code a bit
> longer in the hope that the resulting code would still work under
> Emacs-19, but nowadays this seems very outdated.

sml-mode package from Debian unstable.

-- 
Michael Welsh Duggan
(mwd <at> cert.org)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11904; Package emacs. (Wed, 18 Jul 2012 15:28:02 GMT) Full text and rfc822 format available.

Message #17 received at 11904 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Michael Welsh Duggan <mwd <at> cert.org>
Cc: Michael Welsh Duggan <md5i <at> md5i.com>, 11904 <at> debbugs.gnu.org
Subject: Re: bug#11904: 24.1.50;
	error byte compiling (defvar :foo ':foo), regression from 23.4
Date: Wed, 18 Jul 2012 11:21:15 -0400
>>> (defvar :foo ':foo)
>> I'm curious: where did you find such code?
>> Such code used to be added "implicitly" back in Emacs-19 days because
>> Emacs-19 did not have keywords.  Some packages kept such code a bit
>> longer in the hope that the resulting code would still work under
>> Emacs-19, but nowadays this seems very outdated.
> sml-mode package from Debian unstable.

Duh!  I guess it's time to re-label the 5.0beta1 into 5.0, where
sml-compat.el has been removed (it only provided compatibility for
ancient Emacsen)... OK, done!

This said, I installed the patch below which simply removes the "defvar
of a constant" check.


        Stefan


=== modified file 'src/ChangeLog'
--- src/ChangeLog	2012-07-18 13:20:59 +0000
+++ src/ChangeLog	2012-07-18 15:19:50 +0000
@@ -1,5 +1,8 @@
 2012-07-18  Stefan Monnier  <monnier <at> iro.umontreal.ca>
 
+	* eval.c (Fdefvar): Don't check constants since we only set the var if
+	it's not yet defined anyway (bug#11904).
+
 	* lisp.h (last_undo_boundary): Declare new var.
 	* keyboard.c (command_loop_1): Set it.
 	* cmds.c (Fself_insert_command): Use it to only remove boundaries that

=== modified file 'src/eval.c'
--- src/eval.c	2012-07-10 16:53:26 +0000
+++ src/eval.c	2012-07-18 15:18:14 +0000
@@ -691,18 +691,6 @@
       /* Do it before evaluating the initial value, for self-references.  */
       XSYMBOL (sym)->declared_special = 1;
 
-      if (SYMBOL_CONSTANT_P (sym))
-	{
-	  /* For upward compatibility, allow (defvar :foo (quote :foo)).  */
-	  Lisp_Object tem1 = Fcar (tail);
-	  if (! (CONSP (tem1)
-		 && EQ (XCAR (tem1), Qquote)
-		 && CONSP (XCDR (tem1))
-		 && EQ (XCAR (XCDR (tem1)), sym)))
-	    error ("Constant symbol `%s' specified in defvar",
-		   SDATA (SYMBOL_NAME (sym)));
-	}
-
       if (NILP (tem))
 	Fset_default (sym, eval_sub (Fcar (tail)));
       else





bug closed, send any further explanations to 11904 <at> debbugs.gnu.org and Michael Welsh Duggan <md5i <at> md5i.com> Request was from Stefan Monnier <monnier <at> IRO.UMontreal.CA> to control <at> debbugs.gnu.org. (Thu, 19 Jul 2012 08:19:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 16 Aug 2012 11:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 304 days ago.

Previous Next


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