From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id EF3NBnZWU19HagAA0tVLHw (envelope-from ) for ; Sat, 05 Sep 2020 09:12:22 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id +E2AAnZWU1/EagAAB5/wlQ (envelope-from ) for ; Sat, 05 Sep 2020 09:12:22 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 788239403A5 for ; Sat, 5 Sep 2020 09:12:21 +0000 (UTC) Received: from localhost ([::1]:50682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEUFA-0002NN-Ep for larch@yhetil.org; Sat, 05 Sep 2020 05:12:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kESMO-0003bj-48 for emacs-orgmode@gnu.org; Sat, 05 Sep 2020 03:11:40 -0400 Received: from aibo.runbox.com ([91.220.196.211]:50432) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kESMK-0000FJ-Tb for emacs-orgmode@gnu.org; Sat, 05 Sep 2020 03:11:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zaeph.net; s=selector1; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From; bh=FgGfnPymg/KtEVvdXib9Nzzbkwv0BMOk8vxYYGiVD60=; b=ibRURKlNHLH+beaeOy//oP+lhm 4bCkChLsWBKFscty5NW+yzKtwmwCXs78V4LHNkp0DvQSDa2vpBghAbWm+8ehr5htycGJbAbCOAnNG 6rbqFO+eFyW3E5WFPD9r6DUjg7a4oOfJTfuZSvSurBQfsJ4XEh/00EhLh6n4ZpvTolLt44bgRayJ8 7WflSimc0QRgnWdwClX5xWnI9xm76RBbWqIkDqSvnoi7s6i2tlcDAfzWlGHI4BoMzv0IMQHTh2/nA VyS88e4uWDc3QKP1K0FUd/lprhW/Bs6XXCF8Xbq8AOGJsbIrscTwUDw1/yLP1at7DPI5vtZfwQkyZ mdDTApTw==; Received: from [10.9.9.73] (helo=submission02.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1kESMF-0004fI-Hr; Sat, 05 Sep 2020 09:11:31 +0200 Received: by submission02.runbox with esmtpsa [Authenticated alias (984850)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1kESMC-0003t0-EL; Sat, 05 Sep 2020 09:11:28 +0200 From: Leo Vivier To: Kyle Meyer Subject: Re: [PATCH] org-capture: Update plist before finalizing In-Reply-To: <87zh68g4tf.fsf@kyleam.com> References: <87h7tv9pkm.fsf@hidden> <87zh68g4tf.fsf@kyleam.com> Date: Sat, 05 Sep 2020 09:11:27 +0200 Message-ID: <875z8sbsv4.fsf@hidden> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=91.220.196.211; envelope-from=zaeph@zaeph.net; helo=aibo.runbox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/05 03:11:34 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 05 Sep 2020 05:11:53 -0400 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=zaeph.net header.s=selector1 header.b=ibRURKlN; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.71 X-TUID: d2MW+bf74Arx --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi there, Kyle Meyer writes: > Thanks for the detailed write-up and the patch (and sorry for the slow > reply). No worries, and thanks for the review. > It'd be good to at least point to the motivation/usecase for this change > here. (Your description section above already does a nice job of > that.) Done. I=E2=80=99ve also added a link to this thread. > Convention nit: please end your comment with a period. Done. > Perhaps add a brief mention of `org-capture-after-finalize' (or some > other hint of why) here. I=E2=80=99ve added some details to bridge the gap with the docstring for `org-capture-current-plist'. You=E2=80=99ll find the amended commit below. Best, --=20 Leo Vivier Freelance Software Engineer Website: www.leovivier.com | Blog: www.zaeph.net --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-org-capture-Update-plist-before-finalizing.patch Content-Transfer-Encoding: quoted-printable >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=3DUTF-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=E2=80=99re 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." =20 (run-hooks 'org-capture-prepare-finalize-hook) =20 + ;; 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 --=20 2.28.0 --=-=-=--