unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Change a symbol's plist member with (let ...)?
@ 2014-03-14 21:17 Thorsten Jolitz
  2014-03-14 21:37 ` Nicolas Richard
  2014-03-16 18:10 ` Stefan
  0 siblings, 2 replies; 7+ messages in thread
From: Thorsten Jolitz @ 2014-03-14 21:17 UTC (permalink / raw)
  To: help-gnu-emacs


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




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-03-17  0:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-14 21:17 Change a symbol's plist member with (let ...)? Thorsten Jolitz
2014-03-14 21:37 ` Nicolas Richard
2014-03-14 22:25   ` Thorsten Jolitz
2014-03-15 21:28     ` Nicolas Richard
2014-03-16 16:01       ` Thorsten Jolitz
2014-03-16 18:10 ` Stefan
2014-03-17  0:49   ` Thorsten Jolitz

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).