aboutsummaryrefslogtreecommitdiff
path: root/ennum.el
diff options
context:
space:
mode:
Diffstat (limited to 'ennum.el')
-rw-r--r--ennum.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/ennum.el b/ennum.el
index 49caef0..57b76cd 100644
--- a/ennum.el
+++ b/ennum.el
@@ -294,15 +294,18 @@ last form in BODY."
(insert-file-contents ,file)
,@body))
-(defun ennum-directory-files (directory &optional full include-directories)
+(defun ennum-directory-files (&optional directory full include-directories)
"Return recursively the list of all files under DIRECTORY. Files are
returned in depth first order.
-If FULL is non-nil, absolute file names are returned. Else, the
-file names are relative to DIRECTORY. If INCLUDE-DIRECTORIES is
-non-nil, include directories in the output."
- (let ((files (directory-files-recursively
- directory (rx anything) include-directories)))
+If DIRECTORY is nil, the current working directory is assumed. If
+FULL is non-nil, absolute file names are returned. Else, the file
+names are relative to the current directory. If
+INCLUDE-DIRECTORIES is non-nil, include directories in the
+output."
+ (let* ((directory (or directory default-directory))
+ (files (directory-files-recursively
+ directory (rx anything) include-directories)))
(if full
files
(seq-map (apply-partially 'string-remove-prefix