[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: use of (defvar <foo>)
From: |
Reiner Steib |
Subject: |
Re: use of (defvar <foo>) |
Date: |
Fri, 07 Apr 2006 21:07:48 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
On Fri, Apr 07 2006, Dave Love wrote on address@hidden:
> Reiner Steib <address@hidden> writes:
[ Quote from initial mail added for emacs-devel ]
>> On Thu, Apr 06 2006, Dave Love wrote:
>>> Gnus has lots of instances of `(defvar <foo>)' that aren't protected
>>> by `eval-when-compile' and should be.
>> ,----[ http://article.gmane.org/gmane.emacs.devel/43027 ]
>> | From: Richard M. Stallman
>> | Subject: Re: defvars at compile time
>> |
>> | The only effect of a defvar with no initial value
>> | is to silence the compiler. So it is superfluous
>> | to put it inside eval-when-compile.
>> `----
>
> That's certainly not true in Emacs 21:
>
> (progn
> (with-temp-file "/tmp/x.el"
> (insert "(defvar foo)\n"))
> (byte-compile-file "/tmp/x.el")
> (with-temp-buffer
> (insert-file-contents-literally "/tmp/x.elc")
> (goto-char (point-max))
> (delete-region 1 (line-beginning-position 0))
> (buffer-string)))
> => "(byte-code \"\\301B\\301\\207\" [current-load-list foo] 2)
> "
>
> You can completely screw Emacs if you unload a feature that does that
> on important variables. It also causes confusion with find-function &
> al. I fixed a fair number of cases in the Emacs source that could
> clobber things like `font-lock-keywords' and documented using
> eval-when-compile in the Lisp manual. I don't remember what the
> justification was for the one-arg defvar modifying the load history at
> the time; that sort of policy decision often gets reversed.
Could people on emacs-devel please comment on this?
Should we use (defvar <foo>) or (eval-when-compile (defvar <foo>)) in
Gnus for compatibility with Emacs 21? (Probably the same holds for
MH-E.)
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
- Re: use of (defvar <foo>),
Reiner Steib <=
- Re: use of (defvar <foo>), Stefan Monnier, 2006/04/07
- Re: use of (defvar <foo>), Bill Wohler, 2006/04/07
- Re: use of (defvar <foo>), Dave Love, 2006/04/09
- Re: use of (defvar <foo>), Stefan Monnier, 2006/04/09
- Re: use of (defvar <foo>), Dave Love, 2006/04/11
- Re: use of (defvar <foo>), David Kastrup, 2006/04/11
- Re: use of (defvar <foo>), Dave Love, 2006/04/13
- Re: use of (defvar <foo>), Stefan Monnier, 2006/04/11