branch: externals/denote commit 7299ed9bc00a0bae6ab049f90fffaff5fe0b431f Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Define denote-sequence-get-all-files-with-max-depth --- denote-sequence.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/denote-sequence.el b/denote-sequence.el index bfd26ca25d..ffd9475a69 100644 --- a/denote-sequence.el +++ b/denote-sequence.el @@ -98,6 +98,19 @@ With optional FILES, operate on them, else use the return value of file)) (or files (denote-directory-files))))) +(defun denote-sequence-get-all-files-with-max-depth (depth &optional files) + "Return all files with sequence depth up to DEPTH (inclusive). +With optional FILES, operate on them, else use the return value of +`denote-sequence-get-all-files'." + (delq nil + (mapcar + (lambda (file) + (when-let* ((sequence (denote-retrieve-filename-signature file)) + (components (denote-sequence-split sequence)) + ((>= depth (length components)))) + file)) + (or files (denote-sequence-get-all-files))))) + (defun denote-sequence-get-all-sequences (&optional files) "Return all sequences in `denote-directory-files'. A sequence is a Denote signature that conforms with `denote-sequence-p'.