all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Change a symbol's plist member with (let ...)?
Date: Fri, 14 Mar 2014 22:17:18 +0100	[thread overview]
Message-ID: <87wqfwo4yp.fsf@gmail.com> (raw)


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




             reply	other threads:[~2014-03-14 21:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14 21:17 Thorsten Jolitz [this message]
2014-03-14 21:37 ` Change a symbol's plist member with (let ...)? 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

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wqfwo4yp.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=help-gnu-emacs@gnu.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.