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

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

Re: non word abbrevs


From: Stefan Monnier
Subject: Re: non word abbrevs
Date: Sat, 06 Nov 2021 23:15:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> so it looks like the "auto expand abbrev" feature only works right after
>> a word char, so basically only works for abbrevs whose last char has
>> word syntax.
> Which kind of defeats the idea of being able to define a regex in the first 
> place...

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" ;-)

>> 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.
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)))


-- Stefan




reply via email to

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