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: Mon, 01 Nov 2021 08:43:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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

I wonder why you don't see that on your end.

> :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.  ]

> (setq local-abbrev-table arrows-abbrev-table)
>
> And I get a nice message that reads like this:
>
> [## 0 0 0 0 0 0 0 0 0 0 <== <=> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ==>
> 0 0 0 0 0 0 0 0 0 <- 0 0 0 0 0 0 0 0 <-> 0 0 0 -> 0 0 0]

That's just the printed version of the vector that's used as an
"obarray".  It's mostly meaningless.

> And I guess that's a list that includes possible matches but I'm not seeing 
> => / <= so I wonder.

As I said it's mostly meaningless: it includes *some* of the symbols but
not all.  I had a patch which introduced a real obarray type (instead
of abusing vectors), which could then be printed "properly", a bit like
hash tables, but it had its share of problems.

> Then, I enable abbrev-mode but nothing gets transformed...

That's because it only single-char matches occurred and you had no
single-char abbrev defined?


        Stefan




reply via email to

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