* Re: feature/native-comp f055f52 1/2: * Fix two find function functions for native compilation
[not found] ` <20200308215345.F2DB020B30@vcs0.savannah.gnu.org>
@ 2020-03-08 23:43 ` Stefan Monnier
2020-03-09 7:44 ` Andrea Corallo
2020-03-09 9:03 ` martin rudalics
0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2020-03-08 23:43 UTC (permalink / raw)
To: Andrea Corallo; +Cc: emacs-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/x-markdown; coding=UTF-8, Size: 116 bytes --]
> + ((string-match "\\.eln$" library)
^
\\'
-- Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: feature/native-comp f055f52 1/2: * Fix two find function functions for native compilation
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
1 sibling, 0 replies; 6+ messages in thread
From: Andrea Corallo @ 2020-03-09 7:44 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> + ((string-match "\\.eln$" library)
> ^
> \\'
>
>
> -- Stefan
>
Thanks for spotting it.
Andrea
--
akrl@sdf.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: feature/native-comp f055f52 1/2: * Fix two find function functions for native compilation
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
1 sibling, 1 reply; 6+ messages in thread
From: martin rudalics @ 2020-03-09 9:03 UTC (permalink / raw)
To: Stefan Monnier, Andrea Corallo; +Cc: emacs-devel
>> + ((string-match "\\.eln$" library)
> ^
> \\'
Why?
martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: feature/native-comp f055f52 1/2: * Fix two find function functions for native compilation
2020-03-09 9:03 ` martin rudalics
@ 2020-03-09 11:53 ` Noam Postavsky
2020-03-09 17:11 ` martin rudalics
0 siblings, 1 reply; 6+ messages in thread
From: Noam Postavsky @ 2020-03-09 11:53 UTC (permalink / raw)
To: martin rudalics; +Cc: Emacs developers, Stefan Monnier, Andrea Corallo
On Mon, 9 Mar 2020 at 05:09, martin rudalics <rudalics@gmx.at> wrote:
>
> >> + ((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. Using
string-suffix-p could be even clearer.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: feature/native-comp f055f52 1/2: * Fix two find function functions for native compilation
2020-03-09 11:53 ` Noam Postavsky
@ 2020-03-09 17:11 ` martin rudalics
2020-03-09 17:23 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2020-03-09 17:11 UTC (permalink / raw)
To: Noam Postavsky; +Cc: Andrea Corallo, Stefan Monnier, Emacs developers
>> >> + ((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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: feature/native-comp f055f52 1/2: * Fix two find function functions for native compilation
2020-03-09 17:11 ` martin rudalics
@ 2020-03-09 17:23 ` Stefan Monnier
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2020-03-09 17:23 UTC (permalink / raw)
To: martin rudalics; +Cc: Andrea Corallo, Noam Postavsky, Emacs developers
> But wrt my question I was just curious whether the regexp engine
> contains an optimization that makes "\\'" match faster than "$".
No, \' is no faster than $. It's just The Right Thing here, even tho
the probability that $ will misbehave in this case is very low here
(you'd need to have a file with ".eln\n" embedded somewhere in its name).
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-03-09 17:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
2020-03-09 17:23 ` Stefan Monnier
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).