branch: externals/denote
commit 1d0b6fb5d485ba60f938426b5bf595fda39d832f
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Reimplement commit be6e713 without removing HAS-IDENTIFIER from
denote-directory-files
Thanks to Jean-Philippe Gagné Guay for reminding me that
HAS-IDENTIFIER is for use-cases we support. This was done in issue
655: <https://github.com/protesilaos/denote/issues/655>
---
README.org | 13 ++++++-------
denote.el | 26 ++++++++++++++------------
2 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/README.org b/README.org
index 8733f00ec6..5ce90ac9be 100644
--- a/README.org
+++ b/README.org
@@ -5527,12 +5527,6 @@ The following sections cover the specifics.
of valid files in variable ~denote-directory~. Consider files that
satisfy ~denote-file-has-identifier-p~ and are not backups.
-#+vindex: denote-directory-get-files-function
-+ Variable ~denote-directory-get-files-function~ :: Function to return
- list of Denote files. Each file is a string representing an absolute
- file system path. This is intended for use in the function
- ~denote-directory-files~.
-
#+findex: denote-directory-files
+ Function ~denote-directory-files~ :: Return list of absolute file
paths in variable ~denote-directory~. Files that match
@@ -5546,7 +5540,12 @@ The following sections cover the specifics.
files that satisfy ~denote-file-is-note-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.
+ =OMIT-CURRENT= have been applied. With optional =HAS-IDENTIFIER= as
+ a non-~nil~ value, limit the results to files that have an
+ identifier. With Optional =DIRECTORIES= as a list of directories,
+ search through instead of looking into the variable
+ ~denote-directory~. [ The optional =DIRECTORIES= is part of
+ {{{development-version}}}. ]
#+findex: denote-directory-subdirectories
+ Function ~denote-directory-subdirectories~ :: Return list of
diff --git a/denote.el b/denote.el
index dab0bfd583..34ae65f6a8 100644
--- a/denote.el
+++ b/denote.el
@@ -1320,15 +1320,14 @@ operation therein."
(not (backup-file-name-p file))))
(denote--directory-all-files-recursively dirs))))
-(defvar denote-directory-get-files-function #'denote-directory-get-files
- "Function to return list of Denote files.
-Each file is a string representing an absolute file system path. This
-is intended for use in the function `denote-directory-files'.")
-
-;; NOTE 2025-12-22: The HAS-IDENTIFIER is there because we provide the
-;; `denote-directory-get-files-function'. For core Denote, the
-;; `denote-directory-get-files' already does `denote-file-has-identifier-p'.
-(defun denote-directory-files (&optional files-matching-regexp omit-current
text-only exclude-regexp has-identifier)
+(make-obsolete-variable
+ 'denote-directory-get-files-function
+ "advanced users should write an advice for `denote-directory-files'"
+ "4.2.0")
+
+;; 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 directories)
"Return list of absolute file paths in variable `denote-directory'.
Files that match `denote-excluded-files-regexp' are excluded from the
list.
@@ -1351,8 +1350,11 @@ 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 (funcall denote-directory-get-files-function)))
+files that have an identifier.
+
+With optional DIRECTORIES, search through them instead of in the
+variable `denote-directory'."
+ (let ((files (denote-directory-get-files directories)))
(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
@@ -1556,7 +1558,7 @@ Return the absolute path to the matching file."
(denote-directories-get-common-root roots)))
(files (denote-directory-files
(or denote-file-prompt-use-files-matching-regexp
files-matching-regexp)
- :omit-current nil nil has-identifier))
+ :omit-current nil nil has-identifier roots))
(relative-files (if single-dir-p
(mapcar
(lambda (file)