From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qBlXMiZjM2N3SAAAbAwnHQ (envelope-from ) for ; Tue, 27 Sep 2022 22:55:02 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id onFDMiZjM2NT3gAAauVa8A (envelope-from ) for ; Tue, 27 Sep 2022 22:55:02 +0200 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 B757031D1A for ; Tue, 27 Sep 2022 22:55:01 +0200 (CEST) Received: from localhost ([::1]:53536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odHbY-0007Wj-S6 for larch@yhetil.org; Tue, 27 Sep 2022 16:55:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odHJd-00025B-Pu for emacs-orgmode@gnu.org; Tue, 27 Sep 2022 16:36:29 -0400 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]:46886) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odHJc-0006Jf-3o for emacs-orgmode@gnu.org; Tue, 27 Sep 2022 16:36:29 -0400 Received: by mail-qk1-x732.google.com with SMTP id d17so6755550qko.13 for ; Tue, 27 Sep 2022 13:36:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:in-reply-to:date:subject:to:from:user-agent :references:from:to:cc:subject:date; bh=b6e2co85i0aMqrowolgkTV++JfMzabKSLSQZeDfgzWQ=; b=RouJi4jCb5SIMcqorIrb7+IJhiSq7RgOs2LVGam/CzZxm+iMlvU1UFf104Ujv7gO61 qi3V3/XqLuKQgHTTNfWqWb96uV3TbJElRvy4sL6KERgvBn7N/ljy/67awC6mEwPmkVjT rKjYGQpK5tK788fL/96bWccjFwONy9aGRmB5bgbSodd6bz7zgv9CbbBECUlbCJLAin/l J73HtD1662RHPNd5QBqQjKXx2Z+A1JpzmQpzzKdg/22IJxfpwQp6HYq89q1YVfB3UjuY Cg2UR7HNNemA8AWUmPzdFSx1REU+9hmb12nD/MsAUQfmlr+2NOwu7ory1WFBt9lUFb8m UXdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:in-reply-to:date:subject:to:from:user-agent :references:x-gm-message-state:from:to:cc:subject:date; bh=b6e2co85i0aMqrowolgkTV++JfMzabKSLSQZeDfgzWQ=; b=ikVzS34Rt6yFADrKN4RZ5+8JWB+gs3TfOI0CSVEGIbIJW3CYOtbzx8WlovQImX2hEw yJBRhw8VeDzF99KzHDEWV0+xtap3krYyxjKK5PwkulmJnw3JtrLL/c+FwaMyPHZ19PcJ Imqtm7PVi5mlTHaw49+BJEW0VUBARUjLNwYpQ64GtBuAreXnJgY9fqH6QdQxBtMJECx+ OxBefVepIFqxU4hgJTPR7fBDrCVxXfpRhn/xnwwm0wkLmw/LsBSDnphqedeOOWjikSHC iR/pFzlk4dk3HVHdUmHh8hT31DlNF0NPZsaEcmZsHYHlZXZIBSeYv9/G3wd3S3vkkRKq pblw== X-Gm-Message-State: ACrzQf0/uUStyIjV+fKUngTCwQ1oJHWSP2TF/uBYogLV9F3Zj4oFYGci 9H7p0qzzQChi7DRRE4KwY5PZgtH/1cQ= X-Google-Smtp-Source: AMsMyM5oOQI9ouzjZO7BpJscMyI1+Jx/Oq/Kkdw/IIBxysQ8qcwebJsWqt3RWECHCEi/J+4HNaoKUw== X-Received: by 2002:a37:9ac2:0:b0:6cd:e304:7189 with SMTP id c185-20020a379ac2000000b006cde3047189mr19206189qke.536.1664310986421; Tue, 27 Sep 2022 13:36:26 -0700 (PDT) Received: from nbook ([2601:82:c200:166d:7a0:14e6:e26:75bd]) by smtp.gmail.com with ESMTPSA id d11-20020a05620a240b00b006be8713f742sm1649459qkn.38.2022.09.27.13.36.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 13:36:25 -0700 (PDT) References: <87mtalozym.fsf@gmail.com> <87ill9oz2v.fsf@gmail.com> User-agent: mu4e 1.9.0; emacs 29.0.50 From: No Wayman To: emacs-orgmode@gnu.org Subject: Re: [PATCH] DOCT integration: template specific hooks [9.5.5 (9.5.5-g003cc7 @ /home/n/.emacs.d/elpaca/builds/org/)] Date: Tue, 27 Sep 2022 16:37:28 -0400 In-reply-to: <87ill9oz2v.fsf@gmail.com> Message-ID: <87h70s364b.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::732; envelope-from=iarchivedmywholelife@gmail.com; helo=mail-qk1-x732.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664312101; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=b6e2co85i0aMqrowolgkTV++JfMzabKSLSQZeDfgzWQ=; b=X3gydDC07R7n/XO75wALFpKSY934BW6eyGDrYd3aws0gxBLhXFP1ViFo+5oE5dFUQFOnJE WeiQpA+MiA1DY2SUhcILOVsp81q9p+8TUy6icLrc4hERDAaguePpN7JtoHAdCKxYtxzxxl 0ae3OgaNlu5lMK10R303mx+msiQFLBnZ+CceBf/gm62U3XBADkPH56q0jBhvyOdjUHR7Qj zuSMS05TxH3bLnPQp5nzaAg2T/0USPYldb3dC9Sy/ZJ8gMwox93tv9RAzbkBSCNPRaQtV+ nEYqkLenZBacYEV6T4NbqeVe2psXgDonb19zwb0y4F6OvmTPVb8yVeFE8BWdOg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664312101; a=rsa-sha256; cv=none; b=PXFu1mHjCafKOx898a4zPvpqUTWs2M2TbPDn2RI+PZatIJSpe78DjnNPOFFrXhQ8foNQwe fIgpzWT9gEh2dvXUbYMcNafpzuW5VMfw1W9GVxNg0jCHseqyJVldMFvkVi+PiaVvuyhaGB NLIsx8AtG0dvAnKV4vAcNFlqbKhOgvBj6LEq4VuJxpjXz/7GnTADYVk/HGo9j5uYfDH/fC pJdYTfqsURau6OnWsLxu6zbRDgtx+iJLQvx4HLHJR3MnHoM6g4nu0Me3cD8gk+jEokCngN ev8buu6EY6kuf1VqwuXH3RwFMnNH7VtMWKGcJpbxAh0Ysu0nW8B/kFpzZmGyBA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RouJi4jC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -7.83 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RouJi4jC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B757031D1A X-Spam-Score: -7.83 X-Migadu-Scanner: scn0.migadu.com X-TUID: 0d+ejz2DXACS --=-=-= Content-Type: text/plain; format=flowed Attached is a revision which fixes a typo in a comment. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-capture-Add-template-hook-properties.patch Content-Description: fix-typo >From af1d14439d6ada284b5f9b8f17a3da2a172808f1 Mon Sep 17 00:00:00 2001 From: Nicholas Vollmer Date: Tue, 27 Sep 2022 05:44:33 -0400 Subject: [PATCH] org-capture: Add template hook properties * lisp/org-capture.el (org-capture-templates): Document template hook properties. (org-capture-finalize): execute :prepare/:before/:after-finalize functions. (org-capture-place-template): execute :hook functions. * doc/org-manual.org Document template hook properties. --- doc/org-manual.org | 20 ++++++++++++++++++++ lisp/org-capture.el | 21 +++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/doc/org-manual.org b/doc/org-manual.org index ab8a295e5..ed2322949 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -7838,6 +7838,26 @@ Now lets look at the elements of a template definition. Each entry in - ~:refile-targets :: Temporarily set ~org-refile-targets~ to the value of this property. + - ~:hook~ :: + + A list of functions run before `org-capture-mode-hook' + when the template is selected. + + - ~:prepare-finalize~ :: + + A list of functions run before `org-capture-prepare-finalize-hook' + when the template is selected. + + - ~:before-finalize~ :: + + A list of functions run before `org-capture-before-finalize-hook' + when the template is selected. + + - ~:after-finalize~ :: + + A list of functions run before `org-capture-after-finalize-hook' + when the template is selected. + **** Template expansion :PROPERTIES: :DESCRIPTION: Filling in information about time and context. diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 428d0ac0e..2004c91fa 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -297,6 +297,21 @@ properties are: :no-save Do not save the target file after finishing the capture. + :hook A list of functions run before + `org-capture-mode-hook' when the template is selected. + + :prepare-finalize A list of functions run before + `org-capture-prepare-finalize-hook' + when the template is selected. + + :before-finalize A list of functions run before + `org-capture-before-finalize-hook' + when the template is selected. + + :after-finalize A list of functions run before + `org-capture-after-finalize-hook' + when the template is selected. + The template defines the text to be inserted. Often this is an Org mode entry (so the first line should start with a star) that will be filed as a child of the target headline. It can also be @@ -751,6 +766,7 @@ captured item after finalizing." (buffer-base-buffer (current-buffer))) (error "This does not seem to be a capture buffer for Org mode")) + (mapc #'funcall (org-capture-get :prepare-finalize t)) (run-hooks 'org-capture-prepare-finalize-hook) ;; Update `org-capture-plist' with the buffer-local value. Since @@ -823,6 +839,7 @@ captured item after finalizing." ;; the indirect buffer has been killed. (org-capture-store-last-position) + (mapc #'funcall (org-capture-get :before-finalize t)) ;; Run the hook (run-hooks 'org-capture-before-finalize-hook)) @@ -871,6 +888,9 @@ captured item after finalizing." ;; Restore the window configuration before capture (set-window-configuration return-wconf)) + ;; Do not use the local arg to `org-capture-get' here. + ;; The buffer-local value has been stored on `org-capture-plist'. + (mapc #'funcall (org-capture-get :after-finalize)) (run-hooks 'org-capture-after-finalize-hook) ;; Special cases (cond @@ -1147,6 +1167,7 @@ may have been stored before." (`item (org-capture-place-item)) (`checkitem (org-capture-place-item))) (setq-local org-capture-current-plist org-capture-plist) + (mapc #'funcall (org-capture-get :hook t)) (org-capture-mode 1)) (defun org-capture-place-entry () -- 2.37.3 --=-=-=--