emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 5c10aa2863 3/4: Make denote-file-prompt accept a


From: ELPA Syncer
Subject: [elpa] externals/denote 5c10aa2863 3/4: Make denote-file-prompt accept a PROMPT-TEXT argument like other prompts
Date: Sat, 23 Mar 2024 03:57:48 -0400 (EDT)

branch: externals/denote
commit 5c10aa2863537537ed3cab791ff43122f8d774d8
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Make denote-file-prompt accept a PROMPT-TEXT argument like other prompts
---
 README.org | 12 +++++++-----
 denote.el  | 12 ++++++++----
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/README.org b/README.org
index 5e60227364..fd7fc4f8e3 100644
--- a/README.org
+++ b/README.org
@@ -4462,11 +4462,13 @@ 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 =FILES-MATCHING-REGEXP=,
-  filter the candidates per the given regular expression. [ As part of
-  {{{development-version}}}, completion candidates have a relative
-  file path, but the return value and what is stored in the minibuffer
-  history is still the full file system path. ]
+  variable ~denote-directory~. With optional =FILES-MATCHING-REGEXP=,
+  filter the candidates per the given regular expression. With
+  optional =PROMPT-TEXT=, use it instead of the default "Select NOTE".
+  [ As part of {{{development-version}}}, completion candidates have a
+  relative file path, but the return value and what is stored in the
+  minibuffer history is still the full file system path. Furthermore,
+  the =PROMPT-TEXT= is added. ]
 
 #+findex: denote-keywords-prompt
 + Function ~denote-keywords-prompt~ :: Prompt for one or more keywords.
diff --git a/denote.el b/denote.el
index d243988379..02d5ddce48 100644
--- a/denote.el
+++ b/denote.el
@@ -1132,19 +1132,23 @@ file in the returned list."
 
 ;; NOTE 2024-02-29: Based on `project--read-file-cpd-relative' from
 ;; the built-in project.el
-(defun denote-file-prompt (&optional files-matching-regexp)
+(defun denote-file-prompt (&optional files-matching-regexp prompt-text)
   "Prompt for file with identifier in variable `denote-directory'.
 With optional FILES-MATCHING-REGEXP, filter the candidates per
-the given regular expression."
+the given regular expression.
+
+With optional PROMPT-TEXT, use it instead of the default call to
+\"Select NOTE\"."
   (when-let ((all-files (denote-directory-files files-matching-regexp 
:omit-current)))
     (let* ((common-parent-directory
             (let ((common-prefix (try-completion "" all-files)))
               (if (> (length common-prefix) 0)
                   (file-name-directory common-prefix))))
            (cpd-length (length common-parent-directory))
+           (prompt-prefix (or prompt-text "Select NOTE"))
            (prompt (if (zerop cpd-length)
-                       "Select note: "
-                     (format "Select note in %s: " common-parent-directory)))
+                       (format "%s: " prompt-prefix)
+                     (format "%s in %s: " prompt-prefix 
common-parent-directory)))
            (included-cpd (when (member common-parent-directory all-files)
                            (setq all-files
                                  (delete common-parent-directory all-files))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]