Thanks, `plist-get' does work.
小江沈 <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."