From 1a3dd7e67a36e3fa595a259eaacaf4805b415b26 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 15 Aug 2022 18:38:37 +0530 Subject: Optionally return files in the current directory. * ennum.el (ennum-directory-files): If directory is not provided, assume it is the current directory. --- ennum.el | 15 +++++++++------ 1 file 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 -- cgit v1.2.3