Further clarification of directory-files* doc

* doc/lispref/files.texi (Contents of Directories):
Precise description of MATCH-REGEXP of directory-files.  Add
directory-files-no-dot-files-regexp.

* lisp/files.el (directory-files-no-dot-files-regexp): Revert last fix.

* src/dired.c (Fdirectory_files)
(Fdirectory_files_and_attributes): Fix wording in docstring.
This commit is contained in:
Michael Albinus 2020-10-19 13:31:33 +02:00
parent 653eab4788
commit 74519db6df
3 changed files with 20 additions and 7 deletions

View file

@ -2926,11 +2926,11 @@ absolute file names. Otherwise, it returns the names relative to
the specified directory.
If @var{match-regexp} is non-@code{nil}, this function returns only
those file names that contain a match for that regular expression---the
other file names are excluded from the list. On case-insensitive
filesystems, the regular expression matching is case-insensitive.
those file names whose non-directory part contain a match for that
regular expression---the other file names are excluded from the list.
On case-insensitive filesystems, the regular expression matching is
case-insensitive.
@c Emacs 19 feature
If @var{nosort} is non-@code{nil}, @code{directory-files} does not sort
the list, so you get the file names in no particular order. Use this if
you want the utmost possible speed and don't care what order the files
@ -3007,6 +3007,19 @@ corresponding argument to @code{file-attributes} (@pxref{Definition
of file-attributes}).
@end defun
@defvr Constant directory-files-no-dot-files-regexp
This regular expression matches any file name except @samp{.} and
@samp{..}. More precisely, it matches parts of any nonempty string
except those two. It is useful as the @var{match-regexp} argument to
@code{directory-files} and @code{directory-files-and-attributes}:
@example
(directory-files "/foo" nil directory-files-no-dot-files-regexp)
@end example
returns @code{nil}, if directory @samp{/foo} is empty.
@end defvr
@defun file-expand-wildcards pattern &optional full
This function expands the wildcard pattern @var{pattern}, returning
a list of file names that match it.

View file

@ -5787,7 +5787,7 @@ If called interactively, then PARENTS is non-nil."
(defconst directory-files-no-dot-files-regexp
"[^.]\\|\\.\\.\\."
"Regexp matching any non-directory part of a file name except \".\" and \"..\".
"Regexp matching any file name except \".\" and \"..\".
More precisely, it matches parts of any nonempty string except those two.
It is useful as the regexp argument to `directory-files' and
`directory-files-and-attributes'.")

View file

@ -293,7 +293,7 @@ DEFUN ("directory-files", Fdirectory_files, Sdirectory_files, 1, 4, 0,
There are three optional arguments:
If FULL is non-nil, return absolute file names. Otherwise return names
that are relative to the specified directory.
If MATCH is non-nil, mention only file names which non-directory part
If MATCH is non-nil, mention only file names whose non-directory part
matches the regexp MATCH.
If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
Otherwise, the list returned is sorted with `string-lessp'.
@ -326,7 +326,7 @@ by `file-attributes'.
This function accepts four optional arguments:
If FULL is non-nil, return absolute file names. Otherwise return names
that are relative to the specified directory.
If MATCH is non-nil, mention only file names which non-directory part
If MATCH is non-nil, mention only file names whose non-directory part
matches the regexp MATCH.
If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
NOSORT is useful if you plan to sort the result yourself.