emacs-devel
[Top][All Lists]
Advanced

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

Re: Support for shorthand emoji input


From: Stefan Monnier
Subject: Re: Support for shorthand emoji input
Date: Fri, 03 Dec 2021 08:14:53 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Eli Zaretskii [2021-12-02 09:55:23] wrote:
> A facility to let users specify text replacements to be done
> on-the-fly as you type.  It should be similar to what the abbrevs do,
> just extended to handle non word-constituent characters, including
> punctuation and symbols.  For example, replacing -- with the em-dash
> character — or 1/2 with ½ or (C) with © or <== with ←.

FWIW, `abbrev.el` already supports abbrevs with non-word-constituents.
This support comes with 2 caveats, admittedly:

- You need to specify a `:regexp` to `define-abbrev-table` which
  describes the form of abbrevs this table should support (and this
  regexp is matched with `looking-back` so it can be a bit tricky to
  get it quite right).
- `self-insert-command` only calls `expand-abbrev` for you when you
  insert a non-word char right after a word-char, so if your abbrev ends
  with a non-word char you can't rely on `self-insert-command` to
  trigger the expansion (unless you add a `post-self-insert-hook` or
  `post-command-hook` or some such).


        Stefan




reply via email to

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