unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: 小江沈 <xiaojiang@siteshen.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: 9261@debbugs.gnu.org
Subject: bug#9261: `let' behavior is strange
Date: Tue, 9 Aug 2011 10:44:20 +0800	[thread overview]
Message-ID: <CALxUCgbHvGrW+A2WqHruuqqkx+apocEH=DUicxep2O_OPN-NzA@mail.gmail.com> (raw)
In-Reply-To: <m2vcu79646.fsf@igel.home>

[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]

Thanks, `plist-get' does work.


2011/8/9 Andreas Schwab <schwab@linux-m68k.org>

> 小江沈 <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."
>

[-- Attachment #2: Type: text/html, Size: 1681 bytes --]

      reply	other threads:[~2011-08-09  2:44 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
2011-08-09  2:44   ` 小江沈 [this message]

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='CALxUCgbHvGrW+A2WqHruuqqkx+apocEH=DUicxep2O_OPN-NzA@mail.gmail.com' \
    --to=xiaojiang@siteshen.com \
    --cc=9261@debbugs.gnu.org \
    --cc=schwab@linux-m68k.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 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).