emacs-devel
[Top][All Lists]
Advanced

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

Re: pre-command-hook with input methods


From: Phillip Lord
Subject: Re: pre-command-hook with input methods
Date: Fri, 06 Feb 2015 15:45:07 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> Gave that a quick go.  As far as I can see, after-insert-chunk-hook
>> runs after the input is complete.
>
> Hmm...
>
>> Likewise, b-c-f which only runs when the buffer has changed.
>
> No, it should run *before* the buffer is changed, and AFAIK the buffer
> *is* changed (by inserting an "a") when you hit the "a".  this "a" will
> get removed later (after you hit the "b") before running the
> self-insert-command which will (re)do the insertion.
>
> Oh, wait, I see that quail-input-method starts by let-binding
> inhibit-modification-hooks, so indeed, before-change-functions won't be run.
> Hmm... of course, you can still try
>
>    (add-function :before input-method-function ...)
>
> but since its default value is nil (i.e. incompatible with
> add-function), it'll be a bit more tricky


That's because by default there's no input method active. So, I guess,
the trick would be to use input-method-activate-hook to advice the
input-method-function.


> (you'll need an :around advice, and you'll need to check the orig
> function (in case it's nil) before calling it).
>
> There's clearly room for improvement here.


A bit messy, yes. I blame all foreigners and their diacritics.

Phil



reply via email to

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