From: Andreas Schwab <schwab@linux-m68k.org>
To: 小江沈 <xiaojiang@siteshen.com>
Cc: 9261@debbugs.gnu.org
Subject: bug#9261: `let' behavior is strange
Date: Mon, 08 Aug 2011 19:15:53 +0200 [thread overview]
Message-ID: <m2vcu79646.fsf@igel.home> (raw)
In-Reply-To: <CALxUCgbeTqaDAPLsXi06WV4vuFW6H=LFdf6NqUvjuCvEwJhEJg@mail.gmail.com> ("小江沈"'s message of "Mon, 8 Aug 2011 15:49:04 +0800")
小江沈 <xiaojiang@siteshen.com> writes:
> (progn (put 'defun 'x "out")
> (let ((old (plist-member (symbol-plist 'defun) 'x)))
> (message "old: %s." old)
> (put 'defun 'x "in")
> (message "old: %s." old)
> nil))
>
> When I eval this form, I get something like this in *message* buffer:
> old: (x out).
> old: (x in).
> nil
This has nothing to do with let. plist-member returns a tail of the
property list, and when the value of an existing property is changed
only the cdr of the cons cell is overwritten by put, so the reference to
the cons cell in `old' will follow the change.
> If it is not a bug, how can I save the prev symbol property?
Use plist-get or get to extract the property value, or make a copy.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2011-08-08 17:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-08 7:49 bug#9261: `let' behavior is strange 小江沈
2011-08-08 17:15 ` Andreas Schwab [this message]
2011-08-09 2:44 ` 小江沈
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2vcu79646.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=9261@debbugs.gnu.org \
--cc=xiaojiang@siteshen.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).