Subject: Re: bug#11904: 24.1.50; error byte compiling (defvar :foo ':foo), regression from 23.4

From: Stefan Monnier <[email-masked]>
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  <[email-masked]>
 
+	* 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