emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: empty-directory predicate, native implementation


From: Drew Adams
Subject: RE: empty-directory predicate, native implementation
Date: Mon, 19 Oct 2020 08:25:12 -0700 (PDT)

> > IOW, what's different, AFAICS, is the match data: the match.
> >
> > So if you use the regexp only with `string-match-p' (which
> > doesn't care about the match data), or if you use it only
> > with `directory-files', then there's no real difference in
> > the effect.  But if you use it for some context where the
> > matched parts are important, that is, where the match-data
> > matters, then there's a big difference.
> 
> Yes. But to be fair, the docstring of directory-files-no-dot-files-regexp
> didn't promise to return any kind of match data. Using it was just using
> an undocumented side effect.

Sure.  It's just a regexp.  Its value says what it's good for.

> > I didn't complain about Emacs changing the value of the
> > variable - no lobbying is needed.  What I said was that
> > "it's not clear to me" why people were claiming that the
> > new regexp is "more correct" than the old one.  (No one
> > ever responded to that, explaining in what way the old
> > one was somehow incorrect.)
> 
> I believe this statement was rather for the different instances of
> regexps over the code, all of them claiming to match just "." and
> "..". And some of them might have been wrong.

My reading of that statement was that the new regexp
was somehow more correct than the old one, at least
for the occurrences in the code.  I asked how/where
it was more correct.

But in this current thread Stefan has mentioned that
it is more correct in that it matches also file names
containing newline chars.  So far, that's the only
indication I've seen of how the new is more correct
than the old.

(Aside from whether/how it might be more correct,
the new is no doubt quicker.)

> > [BTW, neither manual nor doc string for `directory-files'
> > says what MATCH is matched against, other than "file names".
> > But apparently it's matched only against the nondirectory
> > part of file names, even if FULL is non-nil.]
> 
> I've fixed the docstrings of directory-files-no-dot-files-regexp,
> directory-files and directory-files-and-attributes.

Cool.  Thanks for that.



reply via email to

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