summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-12-01 18:16:22 +0200
committerEli Zaretskii <eliz@gnu.org>2015-12-01 18:16:22 +0200
commitb99a34bcb030d59e0e272b3379d1725a6eb01d95 (patch)
tree234daeaec7f2fd12ff3d9d4fa5d1039bc93d51f0 /lisp
parente702ab8d843dd416b6721c2e05be832d69ad1977 (diff)
downloademacs-b99a34bcb030d59e0e272b3379d1725a6eb01d95.tar.gz
Document 'directory-files-recursively'
* lisp/files.el (directory-files-recursively): Doc fix. Rename the argument MATCH to REGEXP, to be more explicit about its form. * doc/lispref/files.texi (Contents of Directories): Improve the documentation of 'directory-files-recursively'. Add cross-references. * etc/NEWS: Move the entry for 'directory-files-recursively' to its place and mark it documented.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/files.el16
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/files.el b/lisp/files.el
index e892ac6b94b..f37c23b7bdd 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -744,11 +744,13 @@ The path separator is colon in GNU and GNU-like systems."
(and (> (length name) 0)
(char-equal (aref name (1- (length name))) ?/)))
-(defun directory-files-recursively (dir match &optional include-directories)
- "Return all files under DIR that have file names matching MATCH (a regexp).
+(defun directory-files-recursively (dir regexp &optional include-directories)
+ "Return list of all files under DIR that have file names matching REGEXP.
This function works recursively. Files are returned in \"depth first\"
-and alphabetical order.
-If INCLUDE-DIRECTORIES, also include directories that have matching names."
+order, and files from each directory are sorted in alphabetical order.
+Each file name appears in the returned list in its absolute form.
+Optional argument INCLUDE-DIRECTORIES non-nil means also include in the
+output directories whose names match REGEXP."
(let ((result nil)
(files nil)
;; When DIR is "/", remote file names like "/method:" could
@@ -764,11 +766,11 @@ If INCLUDE-DIRECTORIES, also include directories that have matching names."
(unless (file-symlink-p full-file)
(setq result
(nconc result (directory-files-recursively
- full-file match include-directories))))
+ full-file regexp include-directories))))
(when (and include-directories
- (string-match match leaf))
+ (string-match regexp leaf))
(setq result (nconc result (list full-file)))))
- (when (string-match match file)
+ (when (string-match regexp file)
(push (expand-file-name file dir) files)))))
(nconc result (nreverse files))))