branch: externals/denote commit 39f8ac2787c94bb8dc84d4f5c05fc9f5ed572d17 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Define 'denote-after-new-note-hook' to run after 'denote' --- README.org | 4 ++++ denote.el | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index c3bbfd6663..98c8c274d3 100644 --- a/README.org +++ b/README.org @@ -171,6 +171,10 @@ value). Once the title is supplied, the ~denote~ command will then ask for keywords. The resulting note will have a file name as already explained: [[#h:4e9c7512-84dc-4dfb-9fa9-e15d51178e5d][The file naming scheme]] +#+vindex: denote-after-new-note-hook +The ~denote~ command runs the hook ~denote-after-new-note-hook~ after +creating the new note. [ Part of {{{development-version}}}. ] + The file type of the new note is determined by the user option ~denote-file-type~ ([[#h:13218826-56a5-482a-9b91-5b6de4f14261][Front matter]]). diff --git a/denote.el b/denote.el index b7b93fe913..43e9007647 100644 --- a/denote.el +++ b/denote.el @@ -1668,10 +1668,15 @@ The meaning of FILES is the same as in `denote--id-exists-p'." ;;;;; The `denote' command and its prompts +(defvar denote-after-new-note-hook nil + "Normal hook that runs after the `denote' command.") + ;;;###autoload (defun denote (&optional title keywords file-type subdirectory date template signature) "Create a new note with the appropriate metadata and file name. +Run the `denote-after-new-note-hook' after creating the new note. + When called interactively, the metadata and file name are prompted according to the value of `denote-prompts'. @@ -1733,7 +1738,8 @@ When called from Lisp, all arguments are optional. (signature (or signature ""))) (denote-barf-duplicate-id id) (denote--prepare-note title kws date id directory file-type template signature) - (denote--keywords-add-to-history keywords))) + (denote--keywords-add-to-history keywords) + (run-hooks 'denote-after-new-note-hook))) (defvar denote--title-history nil "Minibuffer history of `denote-title-prompt'.")