aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-08-15 18:38:37 +0530
committerArun Isaac2022-08-15 18:41:52 +0530
commit1a3dd7e67a36e3fa595a259eaacaf4805b415b26 (patch)
tree9c46b45026dcbc7e2d6b8d866796393c7ed43aa0
parent9b538aca4c8ca7638d10d7a58d0bc908e65160e0 (diff)
downloadennum-1a3dd7e67a36e3fa595a259eaacaf4805b415b26.tar.gz
ennum-1a3dd7e67a36e3fa595a259eaacaf4805b415b26.tar.lz
ennum-1a3dd7e67a36e3fa595a259eaacaf4805b415b26.zip
Optionally return files in the current directory.
* ennum.el (ennum-directory-files): If directory is not provided, assume it is the current directory.
-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