From ab47e50dae4029622d3e8378f816f77153c180d9 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Sat, 25 Jul 2020 21:53:07 +0200 Subject: [PATCH] org-capture: Update plist before finalizing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/org-capture.el (org-capture-finalize): Update `org-capture-plist' with local-value before finalizing. We use the global-variable `org-capture-plist' to populate the local-variable `org-capture-current-plist' on the init of the `org-capture' buffer. However, we do not do the opposite (i.e. update the global-variable with the local-variable) on `org-capture-finalize'. This is fine for the majority of `org-capture-finalize', since we’re using the LOCAL arg of `org-capture-get' to read `org-capture-current-plist' instead of `org-capture-list', but this trick does not work for `org-capture-after-finalize', since the hook is run after the `org-capture-buffer' has been closed. This causes problem with `:kill-buffer t', and it limits what can be done with cleanup functions in `org-capture-after-finalize'. See for details. --- lisp/org-capture.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 0ca75c772..b74978c82 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -735,6 +735,11 @@ captured item after finalizing." (run-hooks 'org-capture-prepare-finalize-hook) + ;; Update `org-capture-plist' with the buffer-local value. Since + ;; captures can be run concurrently, this is to ensure that + ;; `org-capture-after-finalize-hook' accesses the proper plist. + (setq org-capture-plist org-capture-current-plist) + ;; Did we start the clock in this capture buffer? (when (and org-capture-clock-was-started org-clock-marker -- 2.28.0