unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: emacs-devel@gnu.org
Subject: Re: Preventing accidental prefix match in input-method
Date: Fri, 23 Nov 2018 23:47:33 +0100	[thread overview]
Message-ID: <87y39j9zsq.fsf@fastmail.fm> (raw)
In-Reply-To: <jwv8t1jtqin.fsf-monnier+gmane.emacs.devel@gnu.org>


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



  reply	other threads:[~2018-11-23 22:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-23 16:40 Preventing accidental prefix match in input-method Stefan Monnier
2018-11-23 20:29 ` Michael Welsh Duggan
2018-11-23 21:51   ` Stefan Monnier
2018-11-23 22:47     ` Joost Kremers [this message]
2018-11-23 23:03       ` Stefan Monnier
2018-12-17  3:51         ` Amin Bandali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y39j9zsq.fsf@fastmail.fm \
    --to=joostkremers@fastmail.fm \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).