emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-lisp/cl.el (pushnew): void-variable x


From: Kim F. Storm
Subject: Re: emacs-lisp/cl.el (pushnew): void-variable x
Date: Mon, 11 Sep 2006 13:07:11 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Reiner Steib <address@hidden> writes:

> Reverting Richard's last change to cl.el[1] fixed the problem.  The
> following change seems to fix it.  Is this change correct?
>
> --8<---------------cut here---------------start------------->8---
> --- cl.el     11 Sep 2006 11:50:52 +0200      1.49
> +++ cl.el     11 Sep 2006 12:32:09 +0200      
> @@ -160,7 +160,7 @@
>    (if (symbolp place)
>        (if (null keys)
>         `(let ((pushnew-internal ,place))
> -          (add-to-list 'pushnew-internal x nil 'eql)
> +          (add-to-list 'pushnew-internal ,x nil 'eql)
>            (setq ,place pushnew-internal))
>       (list 'setq place (list* 'adjoin x place keys)))
>      (list* 'callf2 'adjoin x place keys)))
> --8<---------------cut here---------------end--------------->8---

Yes it seems correct.

But what's the wisdom behind pushnew-internal [we already know that
PLACE is a symbol]?

If it is aimed at handling the situation where PLACE is not bound on
entry, the let binding to pushnew-internal will also fail AFAICS.

This looks equivalent to me:

(defmacro pushnew (x place &rest keys)
  "(pushnew X PLACE): insert X at the head of the list if not already there.
Like (push X PLACE), except that the list is unmodified if X is `eql' to
an element already on the list.
\nKeywords supported:  :test :test-not :key
\n(fn X PLACE [KEYWORD VALUE]...)"
  (if (symbolp place)
      (if (null keys)
          (list 'add-to-list place x nil 'eql)
        (list 'setq place (list* 'adjoin x place keys)))
    (list* 'callf2 'adjoin x place keys)))



-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]