[Top][All Lists]

[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: Mon, 1 Nov 2021 22:17:28 +0900

> On Nov 1, 2021, at 21:43, Stefan Monnier via Users list for the GNU Emacs 
> text editor <> wrote:
>>>>   :regexp "\(<?[-=]>?\)")
>>>> I must be missing something.
>>> Hmmm... backslashes?  ;-)
>>> The above string is the same as "(<?[-=]>?)" (in recentish Emacsen the
>>> above backslashes should presumably be highlighted in
>>> a font-lock-warning color for that reason).
>> I'm trying in *scratch* with lisp-mode on a recent "master" and I don't get 
>> that...
> I just tried it on my end with both `master` and Emacs-27.1
>    emacs -Q
>    :regexp "\(<?[-=]>?\)")
> and the two backslashes got the `font-lock-warning-face` (the strings
> are colored a kind of brick red and the warning is in red so it doesn't
> stand out as much as I'd like but it's visible).

Ok, I just rebuilt the latest master and emacs -Q shows them... And I am *not* 
going to dive into my init.el at this time of the day...

>> :regexp "\\([<>=-]+\\)"
> And since Emacs will only use the shortest match, it will only use
> one-char-long matches :-(
> Try something like: "[^<>=-]\\([<>=-]+\\)"
> [ Yes, this shortest match business is a PITA.  ]

My abbrevs are arrows composed of < or > at the tips and - or = with a minimum 
of 2 characters and a max of 3:

→ ⇒
← ⇐
↔ ⇔

In a different world, I'd try [<>=-]{2,3}

Is that what you mean ?


reply via email to

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