From: martin rudalics <rudalics@gmx.at>
To: emacs-devel <emacs-devel@gnu.org>
Cc: Alan Mackenzie <acm@muc.de>
Subject: c-post-command
Date: Sun, 27 Oct 2024 10:25:07 +0100 [thread overview]
Message-ID: <0b46e919-da81-4153-b27c-dbd46f5b12f0@gmx.at> (raw)
After setting the major mode of a buffer to 'c-mode' and switching to a
buffer in 'text-mode', the value of 'post-command-hook' in that buffer
includes 'c-post-command'. I suppose this comes from
(add-hook 'post-command-hook 'c-post-command)
in 'c-basic-common-init' which is removed via
(remove-hook 'post-command-hook 'c-post-command)
in 'change-major-mode-hook' that calls 'c-leave-cc-mode-mode'. But such
"removals" happen only when changing the major mode of a buffer and not
when simply switching buffers. Even if 'c-post-command' returns
immediately when not in a 'c-mode' buffer, it is disconcerting to see
that function in ‘post-command-hook’ when working in some other mode.
Is there any reason not to use
(add-hook 'post-command-hook 'c-post-command nil t)
in 'c-basic-common-init'?
As an aside, 'c-leave-cc-mode-mode' also does
(remove-hook 'post-gc-hook 'c-post-gc-hook)))
which I see nowhere added before.
martin
next reply other threads:[~2024-10-27 9:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-27 9:25 martin rudalics [this message]
2024-10-28 16:05 ` c-post-command Alan Mackenzie
2024-10-28 16:34 ` c-post-command martin rudalics
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0b46e919-da81-4153-b27c-dbd46f5b12f0@gmx.at \
--to=rudalics@gmx.at \
--cc=acm@muc.de \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).