unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Noam Postavsky <npostavs@gmail.com>
Cc: Andrea Corallo <akrl@sdf.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: feature/native-comp f055f52 1/2: * Fix two find function functions for native compilation
Date: Mon, 9 Mar 2020 18:11:27 +0100	[thread overview]
Message-ID: <e283f6bd-e28c-9207-96ab-7cbbf2b26751@gmx.at> (raw)
In-Reply-To: <CAM-tV-_5HRkfckyFNs0+LaG6v8mzgdi8EoA2x8jtM7VaFUx77A@mail.gmail.com>

 >>   >> +   ((string-match "\\.eln$" library)
 >>   >                              ^
 >>   >                             \\'
 >>
 >> Why?
 >
 > "\\.eln$" matches lines ending in ".eln", "\\.eln\\'" matches only if
 > the string ends in ".eln", which is presumably the intention.

I didn't read the source but a name like "library" suggests that the
string to match against may contain more than one match.  In either
case, using "\\'" means that that string must be constructed carefully
to eliminate a trailing newline.

But wrt my question I was just curious whether the regexp engine
contains an optimization that makes "\\'" match faster than "$".

 > Using
 > string-suffix-p could be even clearer.

Indeed.

martin



  reply	other threads:[~2020-03-09 17:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200308215344.25963.91575@vcs0.savannah.gnu.org>
     [not found] ` <20200308215345.F2DB020B30@vcs0.savannah.gnu.org>
2020-03-08 23:43   ` feature/native-comp f055f52 1/2: * Fix two find function functions for native compilation Stefan Monnier
2020-03-09  7:44     ` Andrea Corallo
2020-03-09  9:03     ` martin rudalics
2020-03-09 11:53       ` Noam Postavsky
2020-03-09 17:11         ` martin rudalics [this message]
2020-03-09 17:23           ` Stefan Monnier

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=e283f6bd-e28c-9207-96ab-7cbbf2b26751@gmx.at \
    --to=rudalics@gmx.at \
    --cc=akrl@sdf.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=npostavs@gmail.com \
    /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).