emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 2b627aaafd 11/20: Add denote-org-capture-with-pr


From: ELPA Syncer
Subject: [elpa] externals/denote 2b627aaafd 11/20: Add denote-org-capture-with-prompts
Date: Wed, 20 Dec 2023 03:58:01 -0500 (EST)

branch: externals/denote
commit 2b627aaafdb5bd50402e4f87de547b998019bc62
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>

    Add denote-org-capture-with-prompts
---
 denote.el | 42 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/denote.el b/denote.el
index 4567f609b5..6d4a2df7bf 100644
--- a/denote.el
+++ b/denote.el
@@ -3988,10 +3988,44 @@ Consult the manual for template samples."
     (denote--keywords-add-to-history keywords)
     (concat front-matter template denote-org-capture-specifiers))))
 
-(make-obsolete
- 'denote-org-capture-with-prompts
- 'denote-org-capture
- "2.3.0")
+;; TODO 2023-12-02: Maybe simplify `denote-org-capture-with-prompts'
+;; by passing a single PROMPTS that is the same value as `denote-prompts'?
+
+;; TODO 2023-12-02: The `denote-org-capture-with-prompts' is missing a
+;; signature argument, but nobody has asked for it.  I think
+;; refactoring it per the above TODO is better, anyway.  But maybe do
+;; this after version 2.2.0 is out.
+
+;;;###autoload
+(defun denote-org-capture-with-prompts (&optional title keywords subdirectory 
date template)
+  "Like `denote-org-capture' but with optional prompt parameters.
+
+When called without arguments, do not prompt for anything.  Just
+return the front matter with title and keyword fields empty and
+the date and identifier fields specified.  Also make the file
+name consist of only the identifier plus the Org file name
+extension.
+
+Otherwise produce a minibuffer prompt for every non-nil value
+that corresponds to the TITLE, KEYWORDS, SUBDIRECTORY, DATE, and
+TEMPLATE arguments.  The prompts are those used by the standard
+`denote' command and all of its utility commands.
+
+When returning the contents that fill in the Org capture
+template, the sequence is as follows: front matter, TEMPLATE, and
+then the value of the user option `denote-org-capture-specifiers'.
+
+Important note: in the case of SUBDIRECTORY actual subdirectories
+must exist---Denote does not create them.  Same principle for
+TEMPLATE as templates must exist and are specified in the user
+option `denote-templates'."
+  (let ((denote-prompts '()))
+    (when template (push 'template denote-prompts))
+    (when date (push 'date denote-prompts))
+    (when subdirectory (push 'subdirectory denote-prompts))
+    (when keywords (push 'keywords denote-prompts))
+    (when title (push 'title denote-prompts))
+    (denote-org-capture)))
 
 (defun denote-org-capture-delete-empty-file ()
   "Delete file if capture with `denote-org-capture' is aborted."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]