emacs-devel
[Top][All Lists]

## Re: Preventing accidental prefix match in input-method

 From: Joost Kremers Subject: Re: Preventing accidental prefix match in input-method Date: Fri, 23 Nov 2018 23:47:33 +0100 User-agent: mu4e 1.1.0; emacs 26.1


On Fri, Nov 23 2018, Stefan Monnier wrote:

I'd like to setup an input method where I have a mapping

\b  =>  β

but where I'd like it that when the user enters \beta
the result is \beta rather than βeta.

I know I can do it by adding mappings

\ba  =>  \ba
\bb  =>  \bb
\bc  =>  \bc
\bd  =>  \bd
\be  =>  \be
...

but that would blow up my input method by a factor 50.
Is there a better solution?


Would adding a mapping from βeta to \beta work?


I didn't mean that only \beta stays untouched, sorry.

\big should also stay as \big rather than be turned into βig, and same for all other \b<something> where <something> is made up of
alphabetic characters.


IOW I'd like to be able to say something like "\b is rewritten to β but
only if immediately followed by a word boundary".



You could always create mapping of the form "\b " (i.e., with a space) => β, but then you may need to add more mappings such as "\b.", "\b,", etc., all mapping to β. Also not ideal.


The way to deal with this, AFAICT, is to add a binding that effectively cancels the "special" character. For example, latin-9-prefix uses space for this: typing ' followed by a gives «á», but ' + space + a gives «'a». The TeX input method allows you to type backslash twice to get a single backslash.


So you could add a mapping from "\\" or "\ " to "\" and accustom yourself to typing "\\beta" or "\ beta" to get "\beta".


--
Joost Kremers
Life has its moments