all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mario Lang <mlang@delysid.org>
To: emacs-devel@gnu.org
Subject: (setq x (plist-put x :new 'value))
Date: Sat, 22 Aug 2009 00:08:25 +0200	[thread overview]
Message-ID: <87hbw0es6e.fsf@x2.delysid.org> (raw)

Hi.

The docstring of plist-put reads:

---<snip>---
(plist-put PLIST PROP VAL)

Change value in PLIST of PROP to VAL.
PLIST is a property list, which is a list of the form
(PROP1 VALUE1 PROP2 VALUE2 ...).  PROP is a symbol and VAL is any object.
If PROP is already a property on the list, its value is set to VAL,
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?

--- a/src/fns.c
+++ b/src/fns.c
@@ -2005,8 +2005,7 @@ DEFUN ("plist-put", Fplist_put, Splist_put, 3, 3, 0,
 PLIST is a property list, which is a list of the form
 \(PROP1 VALUE1 PROP2 VALUE2 ...).  PROP is a symbol and VAL is any object.
 If PROP is already a property on the list, its value is set to VAL,
-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.
+otherwise the new PROP VAL pair is added.  The new plist is returned.
 The PLIST is modified by side effects.  */)
      (plist, prop, val)
      Lisp_Object plist;

-- 
CYa,
  ⡍⠁⠗⠊⠕




             reply	other threads:[~2009-08-21 22:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-21 22:08 Mario Lang [this message]
2009-08-21 22:49 ` (setq x (plist-put x :new 'value)) Harald Hanche-Olsen

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=87hbw0es6e.fsf@x2.delysid.org \
    --to=mlang@delysid.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.