branch: externals/denote
commit 7d18f17a1944a5c35b8256df840e224cb5d2e3ff
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Make denote-link-return-links accept optional FILES
---
 README.org | 5 ++++-
 denote.el  | 7 +++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index 6a6d693b92..659168df3f 100644
--- a/README.org
+++ b/README.org
@@ -5496,7 +5496,10 @@ The following sections cover the specifics.
 
 #+findex: denote-link-return-links
 + Function ~denote-link-return-links~ :: Return list of links in
-  current or optional =FILE=.  Also see ~denote-link-return-backlinks~.
+  current or optional =FILE=. With optional =FILES= consider only
+  those, otherwise use the return value of ~denote-directory-files~.
+  Also see ~denote-link-return-backlinks~. [ Optional =FILES= is part
+  of {{{development-version}}}. ]
 
 #+findex: denote-link-return-backlinks
 + Function ~denote-link-return-backlinks~ :: Return list of backlinks
diff --git a/denote.el b/denote.el
index 5b5f8e229a..280bcc71eb 100644
--- a/denote.el
+++ b/denote.el
@@ -4902,14 +4902,17 @@ the generic one."
                     nil t nil 'denote-link-find-file-history)))
     (expand-file-name selected (denote-directory))))
 
-(defun denote-link-return-links (&optional file)
+(defun denote-link-return-links (&optional file files)
   "Return list of links in current or optional FILE.
+With optional FILES, consider only those, otherwise use the return value
+of `denote-directory-files'.
+
 Also see `denote-link-return-backlinks'."
   (when-let* ((current-file (or file (buffer-file-name)))
               ((denote-file-has-supported-extension-p current-file))
               (file-type (denote-filetype-heuristics current-file))
               (regexp (denote--link-in-context-regexp file-type))
-              (files (denote-directory-files))
+              (files (or files (denote-directory-files)))
               (file-identifiers
                (with-temp-buffer
                  (insert-file-contents current-file)

Reply via email to