GNU bug report logs -
#9261
`let' behavior is strange
Previous Next
Reported by: 小江沈 <xiaojiang <at> siteshen.com>
Date: Mon, 8 Aug 2011 15:46:02 UTC
Severity: normal
Tags: notabug
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 9261 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thanks, `plist-get' does work.
2011/8/9 Andreas Schwab <schwab <at> linux-m68k.org>
> 小江沈 <xiaojiang <at> 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 <at> linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>
[Message part 2 (text/html, inline)]
This bug report was last modified 13 years and 290 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.