Gnus development mailing list
 help / color / mirror / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
Cc: ding@gnus.org, emacs-devel@gnu.org
Subject: Re: use of (defvar <foo>)
Date: Fri, 07 Apr 2006 21:07:48 +0200	[thread overview]
Message-ID: <v9r7499pbv.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <rzqek09mwvl.fsf@loveshack.ukfsn.org> (Dave Love's message of "Fri, 07 Apr 2006 12:46:22 +0100")

On Fri, Apr 07 2006, Dave Love wrote on ding@gnus.org:

> Reiner Steib <reinersteib+gmane@imap.cc> 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 \"\\301\bB\x10\\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/

  reply	other threads:[~2006-04-07 19:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-06 19:24 Dave Love
2006-04-06 19:58 ` Reiner Steib
2006-04-07 11:46   ` Dave Love
2006-04-07 19:07     ` Reiner Steib [this message]
2006-04-07 20:45       ` Stefan Monnier
2006-04-07 23:48         ` Bill Wohler
2006-04-09 13:56         ` Dave Love
2006-04-09 14:02           ` David Kastrup
2006-04-11 16:45             ` Dave Love
2006-04-10  0:29           ` Stefan Monnier
2006-04-11 17:06             ` Dave Love
2006-04-11 17:31               ` David Kastrup
2006-04-13 16:44                 ` Dave Love
2006-04-11 18:42               ` Stefan Monnier
2006-04-13 16:51                 ` Dave Love
2006-04-08 16:17       ` Richard Stallman
2006-04-09 14:03         ` Dave Love
2006-04-11  6:28     ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v9r7499pbv.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    --cc=ding@gnus.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).