Function: denote-directory-files
denote-directory-files is a byte-compiled function defined in
denote.el.
Signature
(denote-directory-files &optional FILES-MATCHING-REGEXP OMIT-CURRENT TEXT-ONLY EXCLUDE-REGEXP HAS-IDENTIFIER)
Documentation
Return list of absolute file paths in variable denote-directory(var)/denote-directory(fun).
Files that match denote-excluded-files-regexp are excluded from the
list.
Files only need to have an identifier. The return value may thus
include file types that are not implied by the variable
denote-file-type(var)/denote-file-type(fun).
With optional FILES-MATCHING-REGEXP, restrict files to those matching the given regular expression.
With optional OMIT-CURRENT as a non-nil value, do not include the current Denote file in the returned list.
With optional TEXT-ONLY as a non-nil value, limit the results to
text files that satisfy denote-file-has-supported-extension-p.
With optional EXCLUDE-REGEXP exclude the files that match the given regular expression. This is done after FILES-MATCHING-REGEXP and OMIT-CURRENT have been applied.
With optional HAS-IDENTIFIER as a non-nil value, limit the results to files that have an identifier.
Source Code
;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
;; The HAS-IDENTIFIER is there because we support cases where files do
;; not have an identifier.
(defun denote-directory-files (&optional files-matching-regexp omit-current text-only exclude-regexp has-identifier)
"Return list of absolute file paths in variable `denote-directory'.
Files that match `denote-excluded-files-regexp' are excluded from the
list.
Files only need to have an identifier. The return value may thus
include file types that are not implied by the variable
`denote-file-type'.
With optional FILES-MATCHING-REGEXP, restrict files to those
matching the given regular expression.
With optional OMIT-CURRENT as a non-nil value, do not include the
current Denote file in the returned list.
With optional TEXT-ONLY as a non-nil value, limit the results to
text files that satisfy `denote-file-has-supported-extension-p'.
With optional EXCLUDE-REGEXP exclude the files that match the given
regular expression. This is done after FILES-MATCHING-REGEXP and
OMIT-CURRENT have been applied.
With optional HAS-IDENTIFIER as a non-nil value, limit the results to
files that have an identifier."
(let ((files (denote--directory-get-files)))
(when (and omit-current buffer-file-name (denote-file-has-identifier-p buffer-file-name))
(setq files (delete buffer-file-name files)))
(when files-matching-regexp
(let ((dirs (denote-directories)))
(setq files (seq-filter
(lambda (f)
(string-match-p files-matching-regexp (denote--get-file-name-relative-to-directories f dirs)))
files))))
(when text-only
(setq files (seq-filter #'denote-file-has-supported-extension-p files)))
(when has-identifier
(setq files (seq-filter #'denote-file-has-identifier-p files)))
(when exclude-regexp
(setq files (seq-remove
(lambda (file)
(string-match-p exclude-regexp file))
files)))
files))