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

    Make denote-add-front-matter default to file title and keywords
---
 denote.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/denote.el b/denote.el
index 1b3bd68884..d9347cccd2 100644
--- a/denote.el
+++ b/denote.el
@@ -3463,10 +3463,13 @@ relevant front matter.
   That Vertico command is bound to M-RET as of this writing on
   2024-02-29 09:24 +0200. ]"
   (interactive
-   (list
-    (buffer-file-name)
-    (denote-title-prompt nil "Add TITLE (empty to ignore)")
-    (denote-keywords-sort (denote-keywords-prompt "Add KEYWORDS (empty to 
ignore)"))))
+   (let* ((file buffer-file-name)
+          (default-title (denote-retrieve-filename-title file))
+          (default-keywords (string-join 
(denote-retrieve-filename-keywords-as-list file) ",")))
+     (list
+      file
+      (denote-title-prompt default-title "Add TITLE (empty to ignore)")
+      (denote-keywords-sort (denote-keywords-prompt "Add KEYWORDS (empty to 
ignore)" default-keywords)))))
   (when-let ((denote-file-is-writable-and-supported-p file)
              (id (denote-retrieve-filename-identifier file))
              (file-type (denote-filetype-heuristics file)))

Reply via email to