[Top][All Lists]

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

Re: non word abbrevs

From: Kevin Vigouroux
Subject: Re: non word abbrevs
Date: Mon, 08 Nov 2021 06:36:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Jean-Christophe Helary <> writes:

>> On Nov 7, 2021, at 12:15, Stefan Monnier via Users list for the GNU Emacs 
>> text editor <> wrote:
>> Not completely: the original motivation for adding that `:regexp`
>> keyword was to handle abbrevs of the form "`foo" as well as others of
>> the form "foo/bar" ;-)
> And the overall feature seems severely under-documented... Honestly, I barely 
> understood your explanations...
> Maybe expecting to have abbrevs work way was a mistake, but it does not seem 
> possible to have (easy...) arbitrary string expansion in out-of-the-box-emacs 
> without abbrevs.
> Would there be another more idiomatic way ?
> I know about assigning key shortcuts to arbitrary string insertion,
> but that needlessly fills the keymaps with shortcuts that could be put
> to better use *and* the combination would be longer to enter than a
> normal abbrev...

You can insert a Unicode character with `insert-char'. This does not
shorten the typing but at least you can insert any character easily.

In word processors, you can insert these characters if they are
available in the dialog box called “Special Characters”.

>>>> You might want to `M-x report-emacs-bug` and request that this
>>>> constraint be made more flexible.
>>> I will. Thank you again.
>> In the mean time, you might be able to implement
>> a `post-self-insert-hook` which runs expands your abbrevs.
> Christmas in November ? :-)
>> You could start with something like:
>>    (add-hook 'post-self-insert-hook #'my-expand-arrow-abbrevs)
>>    (defun my-expand-arrow-abbrevs ()
>>      (if (memq (char-before) '(?= ?< ?-))
>>          (expand-abbrev)))
> I'll try that and will report. Thank you !

Best regards,
Kevin Vigouroux

reply via email to

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