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

    Make denote-title-prompt accept optional PROMPT-TEXT
---
 README.org |  6 ++++--
 denote.el  | 15 ++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/README.org b/README.org
index 80cf7321ca..2e3241f9f2 100644
--- a/README.org
+++ b/README.org
@@ -3828,8 +3828,10 @@ might change them without further notice.
   include the optional =PROMPT-TEXT=. ]
 
 #+findex: denote-title-prompt
-+ Function ~denote-title-prompt~ :: Read file title for ~denote~.
-  With optional =DEFAULT-TITLE= use it as the default value.
++ Function ~denote-title-prompt~ :: Read file title for ~denote~. With
+  optional =DEFAULT-TITLE= use it as the default value. With optional
+  =PROMPT-TEXT= use it in the minibuffer instead of the generic
+  prompt. [ The =PROMPT-TEXT= is part of {{{development-version}}}. ]
 
 #+vindex: denote-title-prompt-current-default
 + Variable ~denote-title-prompt-current-default~ :: Currently bound
diff --git a/denote.el b/denote.el
index c4b7041b82..ec84e2e40f 100644
--- a/denote.el
+++ b/denote.el
@@ -1758,14 +1758,15 @@ command that needs to supply a default title before 
calling
 `denote-title-prompt' and use `unwind-protect' to set its value
 back to nil.")
 
-(defun denote-title-prompt (&optional default-title)
+(defun denote-title-prompt (&optional default-title prompt-text)
   "Read file title for `denote'.
-With optional DEFAULT-TITLE use it as the default value."
-  (let* ((def (or default-title denote-title-prompt-current-default))
-         (format (if (and def (not (string-empty-p def)))
-                     (format "File title [%s]: " def)
-                   "File title: ")))
-    (read-string format nil 'denote--title-history def)))
+With optional DEFAULT-TITLE use it as the default value.  With
+optional PROMPT-TEXT use it in the minibuffer instead of the
+generic prompt."
+  (let ((def (or default-title denote-title-prompt-current-default)))
+    (read-string
+     (format-prompt (or prompt-text "File title") def)
+     nil 'denote--title-history def)))
 
 (defvar denote--file-type-history nil
   "Minibuffer history of `denote-file-type-prompt'.")

Reply via email to