[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scan of regexps in emacs
From: |
Mattias Engdegård |
Subject: |
Re: Scan of regexps in emacs |
Date: |
Tue, 12 Mar 2019 11:21:36 +0100 |
11 mars 2019 kl. 23.49 skrev Paul Eggert <address@hidden>:
>
> On 3/11/19 1:51 AM, Mattias Engdegård wrote:
>> - (if (looking-at iso2022-gb-designation)
>> + (if (looking-at "\e\\$A")
>>
>> What about (regexp-quote iso2022-gb-designation) instead, possibly hoisted?
>> (Of course the reader then wonders why iso2022-ascii-designation isn't
>> quoted. Oh dear.)
>
> I went through exactly the same thought processes. As variables like
> iso2022-gb-designation are not really intended to be changed, I figured
> it was OK to simply expand it inline by hand.
Agreed. In fact, it is so common to see looking-at with a nonliteral-free
pattern that it might be worth adding a standard looking-at-string-p for that
purpose. (Or is there already one? With Emacs, you can never be sure.)
That would take care of lots of silly regexp quoting worries, be more readable,
and a little faster.
- Re: Scan of regexps in emacs, (continued)