emacs-devel
[Top][All Lists]
Advanced

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

Re: Timing of input-method output


From: Stefan Monnier
Subject: Re: Timing of input-method output
Date: Tue, 05 Feb 2019 09:49:19 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> yes, that DEL would also need to be special, also not to appear in the
> undo list, since we would want the events to appear to be "ene'" and not
> have a DEL in the middle.

Hmm... yes, I think we'll need to play with this until we find something
good enough.

I can foresee potential interactions also with keyboard macros, so I'm
sure there'll be yet more interactions to deal with.
It's a tricky area.

But that doesn't mean it has to be hard: by making it a new package or
an option that's disabled by default we can play with it and live with
some quirks until it's polished enough to (maybe) become the new default.

> One question I would have wrt to completion is whether and how input
> methods affect the visualisation of the buffer. For example, the one I
> use puts an underline underneath the "e". This clearly needs to happen
> at the right time so it doesn't break the visualisation that both
> company and pabbrev drop into the buffer (it's the visual artifact that
> made me investigate this all in the first place).

AFAIK quail just puts an overlay over the text it has transiently
inserted and that overlay by default has the underline face.  I don't
foresee any particular troublesome interaction here.  Any reason why you
think this will be problematic?

> Is there any way of knowing whether quail is currently offering a choice
> of input?
> `quail-is-waiting-for-another-keystroke-to-work-out-what-to-do-p'
> perhaps?

You could try something like

    (defvar within-the-input-method nil)
    (add-function :around (local 'input-method-function)
                  (lambda (orig-fun &rest args)
                    (let ((within-the-input-method t))
                      (apply orig-fun args))))
                      
which in recent enough Emacsen can even be shortened to

    (defvar within-the-input-method nil)
    (add-function :around (local 'input-method-function)
                  (lambda (&rest args)
                    (let ((within-the-input-method t))
                      (apply args))))

Tho a quick'n'dirty hack might be to simply check
`inhibit-modification-hooks` which should be t when you're within Quail
(because of its use of `with-silent-modification`) and should be nil in
the normal case where the event is read by `read-key-sequence`.


        Stefan




reply via email to

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