From: "Mattias Engdegård" <mattiase@acm.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Scan of regexps in emacs
Date: Tue, 12 Mar 2019 11:21:36 +0100 [thread overview]
Message-ID: <ED045B0E-2306-4E5E-9959-ECC7E40F4002@acm.org> (raw)
In-Reply-To: <7a5591b6-e0a0-f465-719e-e453de1aef59@cs.ucla.edu>
11 mars 2019 kl. 23.49 skrev Paul Eggert <eggert@cs.ucla.edu>:
>
> 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.
prev parent reply other threads:[~2019-03-12 10:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-09 13:26 Scan of regexps in emacs Mattias Engdegård
2019-03-09 14:56 ` Alan Mackenzie
2019-03-09 15:09 ` Alan Mackenzie
2019-03-10 11:19 ` Mattias Engdegård
2019-03-09 17:06 ` Paul Eggert
2019-03-09 17:46 ` Alan Mackenzie
2019-03-11 2:45 ` Paul Eggert
2019-03-11 2:56 ` Clément Pit-Claudel
2019-03-11 3:37 ` Paul Eggert
2019-03-11 8:39 ` Mattias Engdegård
2019-03-11 8:51 ` Mattias Engdegård
2019-03-11 22:49 ` Paul Eggert
2019-03-12 10:21 ` Mattias Engdegård [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ED045B0E-2306-4E5E-9959-ECC7E40F4002@acm.org \
--to=mattiase@acm.org \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).