[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Timing of input-method output
From: |
Phillip Lord |
Subject: |
Re: Timing of input-method output |
Date: |
Thu, 28 Mar 2019 13:54:18 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1.92 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> I've done a bit more work on this and come up with a much simpler
>> solution which is specificially plumbed into quail. It looks like this:
>>
>> modified lisp/international/quail.el
>> @@ -59,6 +59,10 @@ quail
>> "Quail: multilingual input method."
>> :group 'leim)
>>
>> +
>> +(defvar quail-pre-translation-hook nil
>> + "Normal hook run before quail starts or updates a translation.")
>> +
>> ;; Buffer local variables
>>
>> (defvar quail-current-package nil
>> @@ -1548,6 +1552,7 @@ quail-update-translation
>> `quail-current-key'. If CONTROL-FLAG is nil, proceed the translation
>> with more keys."
>> (let ((func (quail-update-translation-function)))
>> + (run-hooks 'quail-pre-translation-hook)
>> (if func
>> (setq control-flag (funcall func control-flag))
>> (cond ((numberp control-flag)
>
> This looks pretty good, but I'd like to better understand why this
> works well. I.e. how did you end up putting it there rather than elsewhere?
I do not have a terribly principled answer to this; quail is complicated
and has lots of edge cases that I do not understand. If I understand it
correctly, I could equally have put this into quail-self-insert-command;
but here it is right before the bit that the translation actually
happens.
>> pre-command-hook is current run by "safe_run_hooks". Does
>> `quail-pre-translation-hook' need to be as well (in which case, it would
>> need uncovering in lisp)? I guess the counter here is that it's possible
>> to get out so long as you don't type certain characters, or you change
>> buffer. But, it leaves emacs fairly unusuable none the less.
>
> IIUC C-\ should get you out, so I don't think it's necessary to take any
> extra caution here.
Yes, if you know what is causing the problem. But you are correct, it is
escapable.
>
>> And, where do you think I should document it? Perhaps "Invoking the
>> Input Method";
>
> That's probably the best place.
Will extend.
Phil