branch: externals/denote
commit 255122193349b794f80ecb4f77dd14b04ace952b
Author: Jean-Philippe Gagné Guay <jeanphilippe...@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe...@gmail.com>

    Add denote-identifier-prompt
---
 denote.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/denote.el b/denote.el
index 211063b2cc..c83547de9d 100644
--- a/denote.el
+++ b/denote.el
@@ -3291,6 +3291,26 @@ packages such as `marginalia' and `embark')."
        nil t nil 'denote-template-history))
      templates)))
 
+(defvar denote-identifier-history nil
+  "Minibuffer history of `denote-identifier-prompt'.")
+
+(defun denote-identifier-prompt (&optional initial-identifier prompt-text)
+  "Prompt for identifier string.
+With optional INITIAL-IDENTIFIER use it as the initial minibuffer
+text.  With optional PROMPT-TEXT use it in the minibuffer instead
+of the default prompt.
+
+Previous inputs at this prompt are available for minibuffer completion
+if the user option `denote-history-completion-in-prompts' is set to a
+non-nil value."
+  (when (and initial-identifier (string-empty-p initial-identifier))
+    (setq initial-identifier nil))
+  (denote--with-conditional-completion
+   'denote-identifier-prompt
+   (format-prompt (or prompt-text "New file IDENTIFIER") nil)
+   denote-identifier-history
+   initial-identifier))
+
 (defvar denote-signature-history nil
   "Minibuffer history of `denote-signature-prompt'.")
 

Reply via email to