[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Change a symbol's plist member with (let ...)?
From: |
Thorsten Jolitz |
Subject: |
Change a symbol's plist member with (let ...)? |
Date: |
Fri, 14 Mar 2014 22:17:18 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Hi List,
the title says it all - is it possible to temporarily change a symbol's
plist member within (let ...)?
#+begin_src emacs-lisp
(plist-get (symbol-plist 'outline-mode)
'derived-mode-parent)
#+end_src
#+results:
: text-mode
For the sake of this example, say I want to "con" the function
`derived-mode-p' and make it believe outline-mode is actually derived
from lisp-mode (or so ...).
How to do this with working code (not pseudo-code)?
#+begin_src emacs-lisp
(defadvice derived-mode-p' (around derived-mode-p-around)
"Con `derived-mode-p' about the true parent-mode of outline-mode."
(when (eq major-mode 'outline-mode)
(let ((...<plist-key derived-mode-parent> 'lisp-mode ...)) ; pseudo-code
ad-do-it))
#+end_src
Or do I have to do it the pedestrian way: do plist-get first, store the
original value, do plist-put with the new value, call ad-do-it, and then
restore the original value again with plist-put?
--
cheers,
Thorsten