Re: How to make word at/before point always be a candidate for quail input method?, Re: How to make word at/before point always be a candidate for quail input method?

James Thomas <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Daan via Users list for the GNU Emacs text editor
<[email protected]> writes:

> For example if I have the following rules:
> - "aa" -> "é"
> - "éb" -> "è"
>
> After typing "aa", "é" is completed and I can't just add "b" to have
> "è"
> any more.
>
> Extending the rules to include "aab" -> "é" isn't really practical
> since
> there will too many rules to list.
>
> ---
> Dan

Eli Zaretskii <[email protected]> writes:

>> Date: Tue, 23 Sep 2025 03:47:35 +0000
>> From: Daan via Users list for the GNU Emacs text editor
>> <[email protected]>
>> 
>> For example if I have the following rules:
>> - "aa" -> "é"
>> - "éb" -> "è"
>> 
>> After typing "aa", "é" is completed and I can't just add "b" to have
>> "è"
>> any more.
>> 
>> Extending the rules to include "aab" -> "é" isn't really practical
>> since
>> there will too many rules to list.
>
> The way Emacs input methods are implemented, they AFAIK work by
> collecting the keys you type, and don't look at the contents of the
> buffer.
>
> But I'm far from being an expert of writing input methods, so maybe
> there's some trick to achieve what you want.  Basically, you need to
> force the input method to push back the character before point onto
> unread-command-events.  Of course, there's then the problem of where
> to stop: for example, what if the buffer has "aaa" and you type "b"?

You can do this with a custom 'update translation' function which, in
addition, does not 'end' the translation after 'aa' (if all this is
worth it, of course). See Japanese, Malayalam etc. for an example.

--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.