branch: externals/denote
commit 9f4a99243c784c8f5779c54a015df283abc0de83
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Change how org-capture hook is added
---
denote-org-capture.el | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/denote-org-capture.el b/denote-org-capture.el
index 17e5780dbc..2de9137636 100644
--- a/denote-org-capture.el
+++ b/denote-org-capture.el
@@ -59,10 +59,6 @@ sample template. We will eventually have a manual."
(denote--path title keywords)
(denote--prepare-note denote-last-title denote-last-keywords
denote-last-path)
(denote--keywords-add-to-history denote-last-keywords)
- ;; TODO 2022-06-05: Is there a better way to set up this hook?
- ;; Alternatively, can we prevent the creation of a file when the
- ;; capture is aborted?
- (add-hook 'org-capture-after-finalize-hook
#'denote-org-capture-delete-empty-file)
(concat denote-last-front-matter denote-org-capture-specifiers)))
(defun denote-org-capture-delete-empty-file ()
@@ -71,6 +67,8 @@ sample template. We will eventually have a manual."
((denote--file-empty-p file)))
(delete-file denote-last-path)))
+(add-hook 'org-capture-after-finalize-hook
#'denote-org-capture-delete-empty-file)
+
;; Samples of an `org-capture-templates' entry:
;;
;; (setq org-capture-templates