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

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

[elpa] externals/denote 77200064dc 2/2: Merge pull request #77 from jean


From: ELPA Syncer
Subject: [elpa] externals/denote 77200064dc 2/2: Merge pull request #77 from jeanphilippegg/template
Date: Sun, 7 Aug 2022 07:57:29 -0400 (EDT)

branch: externals/denote
commit 77200064dc2c4045b58255ae0e6c7df8ae1b9a1a
Merge: 00c4e70dfa 7580c9bee4
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #77 from jeanphilippegg/template
    
    Insert template in denote--prepare-note
---
 denote.el | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/denote.el b/denote.el
index 589eaea1de..39aef659b3 100644
--- a/denote.el
+++ b/denote.el
@@ -834,11 +834,11 @@ With optional DATE, use it else use the current one."
      (t
       (denote--date-org-timestamp date)))))
 
-(defun denote--prepare-note (title keywords date id directory file-type)
+(defun denote--prepare-note (title keywords date id directory file-type 
template)
   "Prepare a new note file.
 
-Arguments TITLE, KEYWORDS, DATE, ID, DIRECTORY, and FILE-TYPE
-should be valid for note creation."
+Arguments TITLE, KEYWORDS, DATE, ID, DIRECTORY, FILE-TYPE,
+and TEMPLATE should be valid for note creation."
   (let* ((default-directory directory)
          (denote-file-type file-type)
          (path (denote--path title keywords default-directory id))
@@ -847,7 +847,9 @@ should be valid for note creation."
                   title (denote--date date) keywords
                   (format-time-string denote--id-format date)
                   file-type)))
-    (with-current-buffer buffer (insert header))
+    (with-current-buffer buffer
+      (insert header)
+      (when template (insert template)))
     (setq denote-last-buffer buffer)
     (setq denote-last-front-matter header)))
 
@@ -961,7 +963,7 @@ When called from Lisp, all arguments are optional.
   is interpreted as the `current-time'.
 
 - TEMPLATE is a symbol which represents the key of a cons cell in
-  the user option `denote-template'.  The value of that key is
+  the user option `denote-templates'.  The value of that key is
   inserted to the newly created buffer after the front matter."
   (interactive
    (let ((args (make-vector 6 nil)))
@@ -984,11 +986,7 @@ When called from Lisp, all arguments are optional.
                       (denote-directory)))
          (template (if (stringp template) template (alist-get template 
denote-templates))))
     (denote--barf-duplicate-id id)
-    (denote--prepare-note (or title "") keywords date id directory file-type)
-    (when template
-      (with-current-buffer (get-file-buffer denote-last-path)
-        (goto-char (point-max))
-        (insert template)))
+    (denote--prepare-note (or title "") keywords date id directory file-type 
template)
     (denote--keywords-add-to-history keywords)))
 
 (defvar denote--title-history nil



reply via email to

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