emacs-devel
[Top][All Lists]
Advanced

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

Re: Fixing post-self-insert-hook.


From: Stefan Monnier
Subject: Re: Fixing post-self-insert-hook.
Date: Fri, 17 Sep 2021 16:04:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> What is sometimes done with it is to effect buffer changes additional to
> the prime change caused by self-insert-function.

FWIW, I think the above "sometimes" really means "always" or "almost
always" ;-)
[ That was the primary motivation for the addition of this hook.  ]

> What isn't fine is when self-insert-function is called from Lisp, as it
> is 293 times from our sources, including from cc-cmds.el.

The question here is why those effects are undesirable while the other
effects (like auto-fill or abbrev expansion) aren't.

I suspect that those 293 uses fall into roughly 3 different camps:

- Those that really do want the full `self-insert-command` effects.
- Those that call `self-insert-command` mostly because the author didn't
  know better and they should really call `insert` instead.
- The rest that wants more than `insert` but less than
  `self-insert-command`.

The last group might indeed deserve a new function.


        Stefan


PS: I do have one regret regarding `post-self-insert-hook`: I should
    have defined a `self-insert-function` variable instead.  This is
    because some of the `post-self-insert-hook` functions would be
    cleaner if they could be turned into (add-function :around
    self-insert-function ...).
    Sadly, `add-function` didn't exist back then :-(




reply via email to

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