[Top][All Lists]

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

Re: (setq x (plist-put x :new 'value))

From: Harald Hanche-Olsen
Subject: Re: (setq x (plist-put x :new 'value))
Date: Fri, 21 Aug 2009 18:49:04 -0400 (EDT)

+ Mario Lang <address@hidden>:

> The docstring of plist-put reads:
> ---<snip>---
> [...]
> otherwise the new PROP VAL pair is added.  The new plist is returned;
> use `(setq x (plist-put x prop val))' to be sure to use the new value.
> The PLIST is modified by side effects.
> ---<snip>---
> The last two lines seem like they are contradicting each other.
> In fact, what plist-put really does if it has to add a new item is
> setcdr on the last cons in the list.  I kind of feel the second last line
> in the docstring should be removed, since (setq x (plist-put x prop val))
> is not necessary.  Or am I missing something?

Yes: the plist could be empty in the first place.

(setq plist nil)
(plist-put plist :foo :bar) ; => (:foo :bar)
plist ; => nil

- Harald

reply via email to

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