From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-devel@gnu.org>
Subject: question about "Making change-major-mode-hook buffer-local while locally let-bound!"
Date: Sun, 20 Jun 2010 09:51:33 -0700 [thread overview]
Message-ID: <B12C1F29818444CA9A46648514F19CA2@us.oracle.com> (raw)
I use a modified definition of `pp-display-expression' that binds these two
hooks to nil around the call (emacs-lisp-mode), to prevent the hooks from
running:
(let ((emacs-lisp-mode-hook nil)
(change-major-mode-hook nil))
(emacs-lisp-mode))
That is the only change - otherwise, emacs -Q.
(No, I do not remember just why I added the c-m-m-h binding (years ago), but I
probably did so because of some problem or annoyance the hook sometimes caused.)
The c-m-m-h binding now results in this message being displayed:
"Making change-major-mode-hook buffer-local while locally let-bound!"
Question:
What is the right way to prevent these hooks from running here?
Do I need to use remove-hook followed by add-hook: saving, emptying and
repopulating the hook? What's the right approach?
---
Also, out of curiosity, where is `change-major-mode-hook' being made
buffer-local? Grepping the lisp sources shows only these hits that seem to
involve making it local:
gnus/gnus-msg.el:449: (gnus-make-local-hook 'change-major-mode-hook)
arc-mode.el:771: (set (make-local-variable 'change-major-mode-hook)
'archive-desummarize)
But arc* and gnus* are not present in `features'. A wild guess suggests maybe
something in font-lock is the culprit (emacs -Q shows `(font-lock-change-mode
t)' as the local value), but I haven't found anything. I didn't find anything
by skimming the C code either.
GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
of 2010-06-14 on 3249CTO
next reply other threads:[~2010-06-20 16:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-20 16:51 Drew Adams [this message]
2010-06-20 18:31 ` question about "Making change-major-mode-hook buffer-local whilelocally let-bound!" Drew Adams
2010-06-20 20:56 ` Davis Herring
2010-06-20 21:24 ` Drew Adams
2010-06-20 23:15 ` question about "Making change-major-mode-hook buffer-local while locally let-bound!" Johan Bockgård
2010-06-20 23:29 ` question about "Making change-major-mode-hook buffer-localwhile " Drew Adams
2010-06-22 0:28 ` question about "Making change-major-mode-hook buffer-local while " Stefan Monnier
2010-06-22 4:10 ` Drew Adams
2010-06-22 5:01 ` Davis Herring
2010-06-22 5:44 ` Drew Adams
-- strict thread matches above, loose matches on Subject: below --
2010-06-20 20:38 MON KEY
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=B12C1F29818444CA9A46648514F19CA2@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@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.