From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id wCLnK8skT197IQAA0tVLHw (envelope-from ) for ; Wed, 02 Sep 2020 04:51:23 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id mHqsJ8skT195UgAAbx9fmQ (envelope-from ) for ; Wed, 02 Sep 2020 04:51:23 +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 CCEEB9403C6 for ; Wed, 2 Sep 2020 04:51:22 +0000 (UTC) Received: from localhost ([::1]:47260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDKjw-0002VF-BU for larch@yhetil.org; Wed, 02 Sep 2020 00:51:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDKjT-0002V1-2q for emacs-orgmode@gnu.org; Wed, 02 Sep 2020 00:50:51 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:54535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDKjN-0002W6-Ns for emacs-orgmode@gnu.org; Wed, 02 Sep 2020 00:50:50 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 08C33DD328; Wed, 2 Sep 2020 00:50:41 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=v3fjdtDq/39K c3YOT7IfbbljmGM=; b=dZlsEJ6gFL5B2XplWs/tEntBUIYQ/gkR9XhivQRb9WEC M88vKt3bWHT0JAuAclshvxUo0Dc89tc8XEeNs9SHexH+CSuA3yp6uM0EqenSG1ee fDjV4zSlcX6OcsQKSC7EBu0BzWtMwb6q5amd6VT7dHoYTwAlDiym9vAG4XcxjuI= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 0142CDD326; Wed, 2 Sep 2020 00:50:41 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:in-reply-to:references:date:message-id:mime-version:content-type:content-transfer-encoding; s=mesmtp; bh=SUoo4bYIdD2Xn8i0wuiKHq1/fqS9TPQyQl8s/gXse30=; b=OU6qDyCDzWScP2k2BgZ5QhPGNkBM/Xa3q4xx2m8DNAc1+kSLHW1VEThRCEklXWa/5rJVkQsEkGVkLqV7X5PpoC62BN3puun9wCAu2P+cU306twchPUdomUST9ybqTIM7+/CgiTzHFM1nTrLHsMffuPFXbpAwvkycXX+3Pd8Zq5k= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id 6CEE4DD325; Wed, 2 Sep 2020 00:50:38 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: Leo Vivier Subject: Re: [PATCH] org-capture: Update plist before finalizing In-Reply-To: <87h7tv9pkm.fsf@hidden> References: <87h7tv9pkm.fsf@hidden> Date: Wed, 02 Sep 2020 00:50:36 -0400 Message-ID: <87zh68g4tf.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Pobox-Relay-ID: D89E7ECC-ECD7-11EA-B81E-843F439F7C89-24757444!pb-smtp21.pobox.com Received-SPF: pass client-ip=173.228.157.53; envelope-from=kyle@kyleam.com; helo=pb-smtp21.pobox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 00:50:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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=pobox.com header.s=sasl header.b=dZlsEJ6g; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=OU6qDyCD; 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.29 X-TUID: 2HhVtc6r1gZq Leo Vivier writes: > Hi there, > > I=E2=80=99m working on the parallelisation of `org-capture' for Org-roam,= and > I=E2=80=99ve run into a problem with the updating of `org-capture-plist'. > > ;;--------------------------------------------------------------------- > ;; DESCRIPTION > ;;--------------------------------------------------------------------- > 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'. [...] > ;;--------------------------------------------------------------------- > ;; PATCH > ;;--------------------------------------------------------------------- > I propose to update `org-capture-plist' early in `org-capture-finalize'. > I don=E2=80=99t think this would have unforeseen effects, since > `org-capture-list' is already meant to be transient, and we=E2=80=99d onl= y be > expanding its use from init-only to init-and-exit. Thanks for the detailed write-up and the patch (and sorry for the slow reply). Based on a quick glance, I too think this would be safe to do. > Subject: [PATCH] org-capture: Update plist before finalizing > > * lisp/org-capture.el (org-capture-finalize): Update > `org-capture-plist' with local-value before finalizing. 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.) > --- > lisp/org-capture.el | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/lisp/org-capture.el b/lisp/org-capture.el > index 2cc1ce394..223ed4124 100644 > --- a/lisp/org-capture.el > +++ b/lisp/org-capture.el > @@ -728,6 +728,9 @@ captured item after finalizing." >=20=20 > (run-hooks 'org-capture-prepare-finalize-hook) >=20=20 > + ;; Update `org-capture-plist' with the local-value > + (setq org-capture-plist org-capture-current-plist) Convention nit: please end your comment with a period. Perhaps add a brief mention of `org-capture-after-finalize' (or some other hint of why) here.