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 18:32:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jean-Christophe Helary [2021-11-06 17:20:58] wrote:
> Ok, so this time I try your regexp (thank you by the way):
>> On Nov 1, 2021, at 21:13, Jean-Christophe Helary 
>> <lists@traduction-libre.org> wrote:
> (define-abbrev-table 'arrows-abbrev-table
>  '(("->" "→")
>    ("<-"  "←")
>    ("<->" "⇆")
>    ("==>" "⇒")
>    ("<==" "⇐")
>    ("<=>" "⇔")
>    )
>    "Arrows as defined on my macOS side."
>    :regexp "[^<>=-]\\([<>=-]+\\)")
>
> (setq local-abbrev-table arrows-abbrev-table)
>
> and I have the abbrev-mode enabled in the *scratch* buffer where I run
>  that, and nothing happens when I type -> for ex... 😢

I tried the above and then `M-x expand-abbrev` and it worked for my test
case, so I guess the problem is in the auto-triggering of abbrevs down
in `self-insert-command`.

And indeed I see:

    if (!NILP (BVAR (current_buffer, abbrev_mode))
        && synt != Sword
        && NILP (BVAR (current_buffer, read_only))
        && PT > BEGV
        && (SYNTAX (!NILP (BVAR (current_buffer, enable_multibyte_characters))
                    ? XFIXNAT (Fprevious_char ())
                    : UNIBYTE_TO_CHAR (XFIXNAT (Fprevious_char ())))
            == Sword))

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.

You might want to `M-x report-emacs-bug` and request that this
constraint be made more flexible.


        Stefan




reply via email to

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