branch: externals/denote
commit 570ac0eebdbec2c17407a88797b13376e7fe340c
Author: Alan Schmitt <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>

    New utility functions
    
    - `denote-link-or-create-with-date' is identical to
      `denote-link-or-create' with a date prompt in case of creation
    - `denote-open-or-create' opens a denote file if it exists, otherwise it
      proposes to create it
    - `denote-open-or-create-with-date' is identical to
      `denote-open-or-create' with a date prompt in case of creation
---
 denote.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/denote.el b/denote.el
index 9aec1977fd..a2e1ae12f3 100644
--- a/denote.el
+++ b/denote.el
@@ -2271,6 +2271,22 @@ file's title.  This has the same meaning as in 
`denote-link'."
 
 (defalias 'denote-link-to-existing-or-new-note (symbol-function 
'denote-link-or-create))
 
+(defun denote-link-or-create-with-date ()
+  (interactive)
+  (let ((denote-prompts '(date title keywords)))
+    (call-interactively #'denote-link-or-create)))
+
+(defun denote-open-or-create (target)
+  (interactive (list (denote-file-prompt)))
+  (if (file-exists-p target)
+      (find-file target)
+    (call-interactively #'denote)))
+
+(defun denote-open-or-create-with-date ()
+  (interactive)
+  (let ((denote-prompts '(date title keywords)))
+    (call-interactively #'denote-open-or-create)))
+
 ;;;;; Link buttons
 
 ;; Evaluate: (info "(elisp) Button Properties")

Reply via email to