[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pre-command-hook with input methods
From: |
Stefan Monnier |
Subject: |
Re: pre-command-hook with input methods |
Date: |
Thu, 05 Feb 2015 15:19:40 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> So, the pre-command-hook runs only *after* the multi-key press behaviour
> has been completed (either by introducing a diacritical letter or by not
> doing so). Hence on pressing "b" it gets run twice -- once to say "a has
> been entered" and once to say "b has been entered".
This is correct, since when you hit `a' the self-insert-command is not
run yet (instead the `a' char is inserted in the buffer by the input
method, which then waits for the next key to see which character was
really meant); it's only run after you hit `b'.
> All fine, but it's breaking my completion framework which removes
> previously offered completions on the pre-command-hook.
Indeed, I wouldn't be surprised if several other uses of
pre-command-hook could suffer from unexpected behaviors in
such situations.
> I need it to run as soon as the "a" key has been pressed.
Of course, you can do that using one of the input-method hooks (maybe
input-method-after-insert-chunk-hook), or you could rely on
before-change-functions.
> Is there a better hook?
I don't think so, sadly.
Maybe we could introduce a new hook like `after-idle-hook'. Part of the
question is what should happen if a timer or a process filter runs
(these can run while Emacs is "idle")? How 'bout when that
timer/process-filter inserts text near/at point?
Stefan
- pre-command-hook with input methods, Phillip Lord, 2015/02/05
- Re: pre-command-hook with input methods,
Stefan Monnier <=
- Re: pre-command-hook with input methods, Phillip Lord, 2015/02/06
- Re: pre-command-hook with input methods, Stefan Monnier, 2015/02/06
- Re: pre-command-hook with input methods, Phillip Lord, 2015/02/06
- Re: pre-command-hook with input methods, Stefan Monnier, 2015/02/06
- Re: pre-command-hook with input methods, Phillip Lord, 2015/02/09
- Re: pre-command-hook with input methods, Stefan Monnier, 2015/02/09
- Re: pre-command-hook with input methods, Phillip Lord, 2015/02/09
- Re: pre-command-hook with input methods, Stefan Monnier, 2015/02/09
- Re: pre-command-hook with input methods, Phillip Lord, 2015/02/10
- Re: pre-command-hook with input methods, Phillip Lord, 2015/02/11