help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: non word abbrevs


From: Jean-Christophe Helary
Subject: Re: non word abbrevs
Date: Sun, 7 Nov 2021 12:24:27 +0900


> On Nov 7, 2021, at 12:15, Stefan Monnier via Users list for the GNU Emacs 
> text editor <help-gnu-emacs@gnu.org> 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 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 !


-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/




reply via email to

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