emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature/android a5b74e2ff62: Initialize text conversion hooks for ea


From: Stefan Monnier
Subject: Re: feature/android a5b74e2ff62: Initialize text conversion hooks for each C Mode buffer
Date: Fri, 27 Oct 2023 16:05:18 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]