unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11904: 24.1.50; error byte compiling (defvar :foo ':foo), regression from 23.4
@ 2012-07-10 23:16 Michael Welsh Duggan
  2012-07-11  7:38 ` Andreas Schwab
  2012-07-12 13:43 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Welsh Duggan @ 2012-07-10 23:16 UTC (permalink / raw)
  To: 11904

[-- Attachment #1: Type: text/plain, Size: 95 bytes --]

Create a new directory and within this directory create the following
two files:

File foo.el:

[-- Attachment #2: foo.el --]
[-- Type: application/emacs-lisp, Size: 37 bytes --]

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


File bar.el:

[-- Attachment #4: bar.el --]
[-- Type: application/emacs-lisp, Size: 18 bytes --]

[-- Attachment #5: Type: text/plain, Size: 1209 bytes --]


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@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@md5i.com)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#11904: 24.1.50; error byte compiling (defvar :foo ':foo), regression from 23.4
  2012-07-10 23:16 bug#11904: 24.1.50; error byte compiling (defvar :foo ':foo), regression from 23.4 Michael Welsh Duggan
@ 2012-07-11  7:38 ` Andreas Schwab
  2012-07-12 13:43 ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2012-07-11  7:38 UTC (permalink / raw)
  To: Michael Welsh Duggan; +Cc: 11904

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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#11904: 24.1.50; error byte compiling (defvar :foo ':foo), regression from 23.4
  2012-07-10 23:16 bug#11904: 24.1.50; error byte compiling (defvar :foo ':foo), regression from 23.4 Michael Welsh Duggan
  2012-07-11  7:38 ` Andreas Schwab
@ 2012-07-12 13:43 ` Stefan Monnier
  2012-07-12 13:52   ` Michael Welsh Duggan
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2012-07-12 13:43 UTC (permalink / raw)
  To: Michael Welsh Duggan; +Cc: 11904

> (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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#11904: 24.1.50; error byte compiling (defvar :foo ':foo), regression from 23.4
  2012-07-12 13:43 ` Stefan Monnier
@ 2012-07-12 13:52   ` Michael Welsh Duggan
  2012-07-18 15:21     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Welsh Duggan @ 2012-07-12 13:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 11904

Stefan Monnier <monnier@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@cert.org)





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#11904: 24.1.50; error byte compiling (defvar :foo ':foo), regression from 23.4
  2012-07-12 13:52   ` Michael Welsh Duggan
@ 2012-07-18 15:21     ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2012-07-18 15:21 UTC (permalink / raw)
  To: Michael Welsh Duggan; +Cc: 11904

>>> (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@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






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-18 15:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-10 23:16 bug#11904: 24.1.50; error byte compiling (defvar :foo ':foo), regression from 23.4 Michael Welsh Duggan
2012-07-11  7:38 ` Andreas Schwab
2012-07-12 13:43 ` Stefan Monnier
2012-07-12 13:52   ` Michael Welsh Duggan
2012-07-18 15:21     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).