branch: externals/consult-denote
commit 4004bf59e85123ac09d41d1cff09d0fee6883d44
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Update consult-denote-file-prompt to be consistent with latest 
denote-file-prompt
---
 consult-denote.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/consult-denote.el b/consult-denote.el
index a9cabf3461..4c28e1a6f8 100644
--- a/consult-denote.el
+++ b/consult-denote.el
@@ -110,15 +110,19 @@ aforementioned function."
             (consult--read new-collection
                            :state (consult--file-preview)
                            :prompt prompt))
-           ;; FIXME 2024-05-08: Is there some elegant way to do this?
            (filename (with-temp-buffer
                        (insert input)
                        (completion-in-region (point-min) (point-max) 
new-collection)
                        (buffer-string))))
-      (when filename
-        (setq denote-file-history (delete input denote-file-history))
-        (add-to-history 'denote-file-history filename))
-      filename)))
+      (setq denote-file-prompt-latest-input input)
+      ;; We want to return the user's input verbatim if it does not
+      ;; match a file uniquely.
+      (if (denote-file-has-identifier-p (expand-file-name filename 
(denote-directory)))
+          (progn
+            (setq denote-file-history (delete input denote-file-history))
+            (add-to-history 'denote-file-history filename)
+            filename)
+        input))))
 
 (defun consult-denote-select-file-prompt (files)
   "Prompt for Denote file among FILES."

Reply via email to