BREAKING make 'denote-file-prompt' accept optional regexp filter

This commit is contained in:
Protesilaos Stavrou 2023-09-25 15:47:36 +03:00
parent 3ad974396d
commit 2e444f3f22
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
2 changed files with 12 additions and 7 deletions

View file

@ -3662,8 +3662,10 @@ might change them without further notice.
#+findex: denote-file-prompt
+ Function ~denote-file-prompt~ :: Prompt for file with identifier in
variable ~denote-directory~. With optional =INITIAL-TEXT=, use it
to prepopulate the minibuffer.
variable ~denote-directory~. With optional =FILES-MATCHING-REGEXP=,
filter the candidates per the given regular expression. [ Refactored
as part of {{{development-version}}} because the old =INITIAL-INPUT=
argument was not actually used anywhere. ]
#+findex: denote-keywords-prompt
+ Function ~denote-keywords-prompt~ :: Prompt for one or more

View file

@ -888,14 +888,17 @@ The path is relative to DIRECTORY (default: default-directory)."
(defvar denote--file-history nil
"Minibuffer history of `denote-file-prompt'.")
(defun denote-file-prompt (&optional initial-text)
(defun denote-file-prompt (&optional files-matching-regexp)
"Prompt for file with identifier in variable `denote-directory'.
With optional INITIAL-TEXT, use it to prepopulate the minibuffer."
(let* ((all-files (denote-all-files))
With optional FILES-MATCHING-REGEXP, filter the candidates per
the given regular expression."
(let* ((files (if files-matching-regexp
(denote-directory-files-matching-regexp files-matching-regexp)
(denote-all-files)))
(completion-ignore-case read-file-name-completion-ignore-case))
(when all-files
(when files
(funcall project-read-file-name-function
"Select note: " all-files nil 'denote--file-history initial-text))))
"Select note: " files nil 'denote--file-history))))
(define-obsolete-function-alias
'denote--retrieve-read-file-prompt