From bc28c85dfceb2e04a72d47d49c1bd2e28b2c3d90 Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Sun, 29 Mar 2020 17:52:22 +0800 Subject: [PATCH] (hotfix): move capture in-process setting as late as possible (#372) This is a hotfix for #369. Currently, calling `org-roam-capture` sets `org-roam-capture--in-process` to `t`, but cancelling the capture process does not reset it to `nil`, causing false errors. The whole nested org-capture processes workaround is brittle, this change moves it as far back as possible, but the whole thing needs to be redesigned. --- org-roam-capture.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org-roam-capture.el b/org-roam-capture.el index c32f258..c43a24b 100644 --- a/org-roam-capture.el +++ b/org-roam-capture.el @@ -265,6 +265,7 @@ This function is used solely in Org-roam's capture templates: see (let ((prop (pop org-roam-capture-additional-template-props)) (val (pop org-roam-capture-additional-template-props))) (org-roam-capture--put prop val))) + (setq org-roam-capture--in-process t) (set-buffer (org-capture-target-buffer file-path)) (widen) (goto-char (point-max)))) @@ -303,7 +304,6 @@ GOTO and KEYS argument have the same functionality as (setq keys (caar org-capture-templates))) (add-hook 'org-capture-after-finalize-hook #'org-roam-capture--save-file-maybe-h) (add-hook 'org-capture-after-finalize-hook #'org-roam-capture--cleanup-h 10) - (setq org-roam-capture--in-process t) (org-capture goto keys))) (provide 'org-roam-capture)