From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Po Lu <luangruo@yahoo.com>
Cc: emacs-devel@gnu.org, bug-cc-mode@gnu.org
Subject: Re: feature/android a5b74e2ff62: Initialize text conversion hooks for each C Mode buffer
Date: Fri, 27 Oct 2023 16:05:18 -0400 [thread overview]
Message-ID: <jwvbkcjsumk.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20230609075536.0E919C1924D@vcs2.savannah.gnu.org> (Po Lu via Mailing list for Emacs changes's message of "Fri, 9 Jun 2023 03:55:35 -0400 (EDT)")
Hi Po Lu (and Alan),
Regarding this patch of yours from a few months back:
> diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
> index 1364117bdc8..88e0aebb9a2 100644
> --- a/lisp/progmodes/cc-mode.el
> +++ b/lisp/progmodes/cc-mode.el
> @@ -251,13 +251,14 @@ control). See \"cc-mode.el\" for more info."
> (when (fboundp 'electric-indent-local-mode)
> (add-hook 'electric-indent-mode-hook 'c-electric-indent-mode-hook)
> (add-hook 'electric-indent-local-mode-hook
> - 'c-electric-indent-local-mode-hook))
> - ;; Set up text conversion, for Emacs >= 30.0
> - (when (boundp 'post-text-conversion-hook)
> - (add-hook 'post-text-conversion-hook #'c-post-text-conversion)))
> + 'c-electric-indent-local-mode-hook)))
> ;; Will try initialization hooks again if they failed.
> (put 'c-initialize-cc-mode initprop c-initialization-ok))))
>
> + ;; Set up text conversion, for Emacs >= 30.0
> + (when (boundp 'post-text-conversion-hook)
> + (add-hook 'post-text-conversion-hook #'c-post-text-conversion))
> +
> (unless new-style-init
> (c-init-language-vars-for 'c-mode)))
Why is this specific to CC-mode?
Is it because other modes handle electricity via the
`post-self-insert-hook` instead?
And why is the hook function added globally?
Wouldn't it be better to add it buffer-locally instead?
Stefan
next parent reply other threads:[~2023-10-27 20:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <168629733551.31969.16984560043233541806@vcs2.savannah.gnu.org>
[not found] ` <20230609075536.0E919C1924D@vcs2.savannah.gnu.org>
2023-10-27 20:05 ` Stefan Monnier [this message]
2023-10-28 0:16 ` feature/android a5b74e2ff62: Initialize text conversion hooks for each C Mode buffer Po Lu
2023-10-28 1:18 ` Stefan Monnier via CC-Mode-help
2023-10-28 2:19 ` Po Lu
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=jwvbkcjsumk.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=bug-cc-mode@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=luangruo@yahoo.com \
/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).