[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs-lisp/cl.el (pushnew): void-variable x
From: |
Stefan Monnier |
Subject: |
Re: emacs-lisp/cl.el (pushnew): void-variable x |
Date: |
Mon, 11 Sep 2006 23:25:47 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
>>> But what's the wisdom behind pushnew-internal [we already know that
>>> PLACE is a symbol]?
>>>
>>> This is in case we someday switch to lexical binding.
>>> add-to-list won't work properly on lexical varables.
>>
>> Ok, but why does it need a defvar ?
> That tells the compiler that pushnew-internal is a special (non-lexical)
> variable.
Honestly, I think using `add-to-list' here makes no sense.
Since we have the variable as a symbol and we're macro-expanding, we can
just use `(unless (member ,element ,var) (setq ,var (cons ,element ,var)))
That'll be a lot more efficient than going through a function call to
add-to-list, using an aux-var accessed via symbol-value and set and checking
`append' arg etc...
`add-to-list' is convenient for ~/.emacs and things like that, but I don't
think this use is appropriate.
Stefan
- emacs-lisp/cl.el (pushnew): void-variable x, Reiner Steib, 2006/09/11
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Kim F. Storm, 2006/09/11
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Reiner Steib, 2006/09/11
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Richard Stallman, 2006/09/11
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Kim F. Storm, 2006/09/11
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Miles Bader, 2006/09/11
- Re: emacs-lisp/cl.el (pushnew): void-variable x,
Stefan Monnier <=
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Miles Bader, 2006/09/12
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Miles Bader, 2006/09/12
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Kim F. Storm, 2006/09/12
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Stefan Monnier, 2006/09/12
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Richard Stallman, 2006/09/12
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Johan Bockgård, 2006/09/13
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Miles Bader, 2006/09/14
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Kim F. Storm, 2006/09/20
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Miles Bader, 2006/09/20
- Re: emacs-lisp/cl.el (pushnew): void-variable x, Kim F. Storm, 2006/09/21