emacs-devel
[Top][All Lists]
Advanced

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

Re: How do you write input methods?


From: André A . Gomes
Subject: Re: How do you write input methods?
Date: Mon, 30 Aug 2021 23:12:07 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: André A. Gomes <andremegafone@gmail.com>
>> Date: Mon, 30 Aug 2021 17:29:15 +0300
>> Cc: emacs-devel@gnu.org
>>
>> I thought I could share this idea, but I'm not sure the maintainers will
>> like the idea to move non-CJK input methods from quail to robin.  From
>> the user perspective, it would bring new interesting features.
>
> I don't think I understand what kind of "move" you are proposing here,
> and what features would that enable.  Please elaborate.

There's a feature regarding input methods (IMs) that Emacs doesn't have,
but it's relatively easy to implement.

Let me describe it.  Let's think about non-CJK IMs, i.e. IMs for which
there is a bijection between the keyboard layouts.  The simplest example
would be the bijection between QWERTY and QWERTZ.  Examples of
"interesting" bijections would be mapping QWERTY to either ЙЦУКЕН
(Russian layout) or the Greek layout.

It's handy to toggle IMs, but here's what often happens: you type a
string; realise that the wrong IM was selected; toggle the IM; delete
the string and retype.  This is tiresome.  This is the itch I'm
scratching.

Robin can be leveraged to implement such a feature.  There are actually
2 features here.

One is to be able to manually transform a string as if it has been typed
with the another IM selected.  Example: take the QWERTY <-> QWERTZ
bijection; "yes" maps to "zes", and vice-versa.

The second is a minor mode that implements a "smarter" way to
automatically toggle IMs.  Example: take the US QWERTY <-> ЙЦУКЕН
bijection; type "ghb" while the US IM is selected; it automatically
changes the IM to russian and transforms it into "при".  There's no word
in english starting with "ghb", whereas "при" is the beginning of the
word "привет".  Indeed, this mode requires some work.

For a more visual explanation and a low quality proof of concept, please
refer to https://github.com/aadcg/emacs-yeis.

When I worked on this, I tried to imagine how it could potentially be
integrated into Emacs.  I see two alternatives.

Here's how I think it should be done.  It makes little sense that all
IMs are defined with quail, expect for CJK and other "complex" ones.
But the "simple" ones should use always robin.  Nothing would change for
the user, and the above mentioned features would be available "for
free".

The alternative is to keep all IMs definition, and add the new ones.
Say that those will have "-robin" as suffix.  In this scenario, you'll
have, for instance, "russian-computer" (defined with quail) and
"russian-computer-robin" (defined with robin).  But they're actually the
same, so it makes little sense.

Hopefully that was clear.


--
André A. Gomes
"Free Thought, Free World"



reply via email to

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