summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Vivier <zaeph@zaeph.net>2020-07-25 21:53:07 +0200
committerBastien <bzg@gnu.org>2020-09-05 11:14:17 +0200
commit3008fb45dccb152797833392b82541ac3811f562 (patch)
treeb50f23cadcaf8bf1cff5b664c6ce01b715ae9a52
parentf2d41de3ed48b98e2e5f77c3fcd387041c9cfafa (diff)
downloadorg-mode-3008fb45dccb152797833392b82541ac3811f562.tar.gz
org-capture: Update plist before finalizing
* 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 <https://orgmode.org/list/87h7tv9pkm.fsf@hidden/> for details.
-rw-r--r--lisp/org-capture.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 2a72651..d336746 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -732,6 +732,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