branch: externals/denote commit 1b2d4319bd5ee0753f907c2c7a780c4abf285c1c Author: Jean-Philippe Gagné Guay <jeanphilippe...@gmail.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Refactor denote command to prepare all arguments for denote--prepare-note --- denote.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/denote.el b/denote.el index 611caa39be..2e9e690133 100644 --- a/denote.el +++ b/denote.el @@ -835,7 +835,7 @@ and TEMPLATE should be valid for note creation." file-type))) (with-current-buffer buffer (insert header) - (when template (insert template))))) + (insert template)))) (defun denote--dir-in-denote-directory-p (directory) "Return DIRECTORY if in variable `denote-directory', else nil." @@ -950,7 +950,8 @@ When called from Lisp, all arguments are optional. ('date (aset args 4 (denote--date-prompt))) ('template (aset args 5 (denote--template-prompt))))) (append args nil))) - (let* ((file-type (denote--file-type-symbol (or file-type denote-file-type))) + (let* ((title (or title "")) + (file-type (denote--file-type-symbol (or file-type denote-file-type))) (date (if (or (null date) (string-empty-p date)) (current-time) (denote--valid-date date))) @@ -958,9 +959,11 @@ When called from Lisp, all arguments are optional. (directory (if (denote--dir-in-denote-directory-p subdirectory) (file-name-as-directory subdirectory) (denote-directory))) - (template (if (stringp template) template (alist-get template denote-templates)))) + (template (if (stringp template) + template + (or (alist-get template denote-templates) "")))) (denote--barf-duplicate-id id) - (denote--prepare-note (or title "") keywords date id directory file-type template) + (denote--prepare-note title keywords date id directory file-type template) (denote--keywords-add-to-history keywords))) (defvar denote--title-history nil