[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 9c85f0c766 2/4: Add 'denote-open-or-create-with-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 9c85f0c766 2/4: Add 'denote-open-or-create-with-command' command |
Date: |
Fri, 13 Oct 2023 03:57:54 -0400 (EDT) |
branch: externals/denote
commit 9c85f0c7660de3c585460b454ea81c395d017877
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add 'denote-open-or-create-with-command' command
---
denote.el | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/denote.el b/denote.el
index 05cd933017..e088b6ad4e 100644
--- a/denote.el
+++ b/denote.el
@@ -2166,6 +2166,24 @@ note's actual title. At the `denote-file-prompt' type
(find-file target)
(denote--command-with-title-history #'denote)))
+;;;###autoload
+(defun denote-open-or-create-with-command ()
+ "Visit TARGET file in variable `denote-directory'.
+If file does not exist, invoke `denote' to create a file.
+
+If TARGET file does not exist, add the user input that was used
+to search for it to the minibuffer history of the
+`denote-file-prompt'. The user can then retrieve and possibly
+further edit their last input, using it as the newly created
+note's actual title. At the `denote-file-prompt' type
+\\<minibuffer-local-map>\\[previous-history-element]."
+ (declare (interactive-only t))
+ (interactive)
+ (let ((target (denote-file-prompt)))
+ (if (and target (file-exists-p target))
+ (find-file target)
+ (denote--command-with-title-history (denote-command-prompt)))))
+
;;;###autoload
(defun denote-keywords-add (keywords)
"Prompt for KEYWORDS to add to the current note's front matter.