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 cBdxAhKNJmM4BAAAbAwnHQ (envelope-from ) for ; Sun, 18 Sep 2022 05:14:26 +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 6KVWAhKNJmMgDwEAauVa8A (envelope-from ) for ; Sun, 18 Sep 2022 05:14:26 +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 2E8303F16C for ; Sun, 18 Sep 2022 05:14:25 +0200 (CEST) Received: from localhost ([::1]:35076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oZkl9-0002ur-Va for larch@yhetil.org; Sat, 17 Sep 2022 23:14:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZkk5-0002tV-OK for emacs-orgmode@gnu.org; Sat, 17 Sep 2022 23:13:13 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:60025) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZkk2-0002DM-UI for emacs-orgmode@gnu.org; Sat, 17 Sep 2022 23:13:13 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 5DFE4320055E for ; Sat, 17 Sep 2022 23:13:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 17 Sep 2022 23:13:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tecosaur.net; h= cc:content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t= 1663470788; x=1663557188; bh=/lraCzRcrNT57wslOM16rIKd+3sLWQ0qi3t 0EM56Md8=; b=nFMuTite/KKjpV9P8jXCXlrgMy8hFd82IKGdclb3j8xu/R5NvR4 Ec0vrfPTJFFY1uM0bBt8PYb0kyJEOIrrhBI1yKNk8wg8aVNbc5qdXuLffCJcfPhR vZLWdQjl5qiS1eiOETOt3HKGcV33Vxq2hqPNzgmmmdIyRoE8+Ra2cw96E543zn10 aoB2YPs2oVmXtUNZJxMhxmx+53o4cqilN0ZGWIStt4k0TviW1gMf01OO5uCB7bp+ eY4WHcYgr90qnaAYRRfXtMdQF9atwwLgE7Stt2c2/p81dWw4XBv7dUMRcf7wqdDR 3dmriBjeBUpIbGzyAAzMXf1Su7K2ptmLJEg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1663470788; x= 1663557188; bh=/lraCzRcrNT57wslOM16rIKd+3sLWQ0qi3t0EM56Md8=; b=C PvemnaqQWfFKhxghTVZzE+KEHooTLwZXSkFO13Kg0aL/KG/MJNaoR5HveuDKEoEL UBDjUVfCuzCoK3PackTVlrRY/Y/5TVo86Htu8O6Gd5SfS/E/jJG931JXA3Kkyah4 Nv6+ecGesOTX30Iaiy3UgFnpiodu33WtyV0fP1p9t2JUDt3C6yV5gtz0iuGZdWXm kB12XVVdoXvtRb98R1Z10rvz8xh2+G+W1hdnp1xodNdINYwghCC2IQR+1kDkYCiO T9iaLZkf+o19fxHXHKpYmq8LlXxwYydekZ4IuDItMUQ1M83+HfEOnS6SAIrFk0Wo RO8rcla70tRqIFqyWmg5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedvfedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuffgfkfggtgesmhdtreertd erjeenucfhrhhomhepvfhimhhothhhhicuoehorhhgmhhouggvsehtvggtrdhtvggtohhs rghurhdrnhgvtheqnecuggftrfgrthhtvghrnhepvdfhffelhfdvleevffffieeukeeuge egueffteevtedtveevvdevvdejjefhtefhnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomhepohhrghhmohguvgesthgvtgdrthgvtghoshgruhhrrd hnvght X-ME-Proxy: Feedback-ID: iecf94634:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 17 Sep 2022 23:13:07 -0400 (EDT) From: Timothy To: emacs-orgmode@gnu.org Subject: [PATCH] Add org-babel-tangle-finished hook Date: Sun, 18 Sep 2022 11:11:09 +0800 User-agent: mu4e 1.8.8; emacs 28.1.50 Message-ID: <87fsgpz876.fsf@tec.tecosaur.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: none client-ip=64.147.123.21; envelope-from=orgmode@tec.tecosaur.net; helo=wout5-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_NONE=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-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663470865; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/lraCzRcrNT57wslOM16rIKd+3sLWQ0qi3t0EM56Md8=; b=ASNj71XvDprPDLZHIsw0Od42uHhWvD/8i5Xny7iAbn1vj5JpAVCGGYG1VdwWlPdpFZ6iQO jrnifAZnc5at+Bnjx9eWly0rjk5j8VtW5THs0NEtmzKjrivNRVJwL45ISZ8AvAVBulLEb8 FR6xs5Zpc+tbOVXrmDG7TFUoJYjvDDLZ39tA92f3xBw6b1dHhMwbyebQeyKHy3lYzZmbvy hcEt7YXRsqq4P9BT7redu23uSR0okMc16rNVpLjXvCzV/1HFpp5u0UFoOvjETkz5+PqUfX glhvwcb8Q3e7anOOOkiorlu2VhF51FmO0Fy0Or3//sTO5hfCfbSHSq4MT9GMpA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663470865; a=rsa-sha256; cv=none; b=a9V+GLvXK4ZETIGJusl4KA2YGb1M97nVEflBd0FRn6VkM4FcwBD95NN64Zah0ZuFQl0Kh1 JBIyVIYXztoPZ0kYrRs94JBRVdKGerdxx5LLiahtHa5PK6+qofWQj+V01U/MMH8BetpGsD tYM7dRYhu64dVp/BGvewSpltzfBfZ5EVWlL7cTpt/i0U8BaFpidnunFQpglLhO6cdNQFuq Es4rBEUaGLvsMhT2axBkL2UU5BIwj+aDiO6NIzj0xPHeuCX5GhGembwIjuA0IBn947JFED UN821Y7NXBMm8q/kYeSXh3I8ou8gSez8zZeSD98WGc+i2+QdB9/yKe0/Tb4yzw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tecosaur.net header.s=fm1 header.b=nFMuTite; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b="C Pvemna"; dmarc=none; 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: 1.76 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tecosaur.net header.s=fm1 header.b=nFMuTite; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b="C Pvemna"; dmarc=none; 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: 2E8303F16C X-Spam-Score: 1.76 X-Migadu-Scanner: scn0.migadu.com X-TUID: nWKwkGD5BQC8 --=-=-= Content-Type: multipart/alternative; boundary="==-=-=" --==-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi All, I recently noticed that there was no entry point for running actions at the conclusion of tangling. We have `org-babel-pre-tangle-hook' which runs at t= he start of the tangle, and `org-babel-post-tangle-hook' which is run in each = tangled file in turn, but nothing to run at the very end once. So, I=E2=80=99ve got a little patch to introduce a new hook `org-babel-pre-tangle-finished' to fill this gap. If there are no objections, I=E2=80=99ll merge this in a few days. All the best, Timothy --==-=-= Content-Type: text/html; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =

Hi All,

I recently noticed that there was no entry point for running actions at the conclusion of tangling. We have org-babel-pre-tangle-hoo= k which runs at the start of the tangle, and org-babel-post-tangle-hook which is run in each tangled file in turn, but nothing to run at the very end once.

So, I=E2=80=99ve got a little patch to introduce a new hook org-babel-pre-tangle-finished to fill this gap.

If there are no objections, I=E2=80=99ll merge this in a few days.

All the best,
Timothy

--==-=-=-- --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ob-tangle-New-tangle-finished-hook.patch >From 1a90aa41ecc0f94a95d422a3ce9981df933b171d Mon Sep 17 00:00:00 2001 From: TEC Date: Sat, 27 Aug 2022 11:15:23 +0800 Subject: [PATCH 1/3] ob-tangle: New tangle-finished hook * lisp/ob-tangle.el (org-babel-tangle, org-babel-tangle-finished-hook): Create a new hook, `org-babel-tangle-finished-hook', and run it at the end of `org-babel-tangle'. --- lisp/ob-tangle.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 29c764ecb..94ef242ff 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -89,6 +89,13 @@ (defcustom org-babel-tangle-body-hook nil :version "24.1" :type 'hook) +(defcustom org-babel-tangle-finished-hook nil + "Hook run at the very end of `org-babel-tangle'. +In this way, it is the counterpart to `org-babel-pre-tangle-hook'." + :group 'org-babel + :package-version '(Org . "9.6") + :type 'hook) + (defcustom org-babel-tangle-comment-format-beg "[[%link][%source-name]]" "Format of inserted comments in tangled code files. The following format strings can be used to insert special @@ -322,6 +329,7 @@ (defun org-babel-tangle (&optional arg target-file lang-re) (org-babel-with-temp-filebuffer file (run-hooks 'org-babel-post-tangle-hook))) path-collector)) + (run-hooks 'org-babel-tangle-finished-hook) path-collector)))) (defun org-babel-interpret-file-mode (mode) -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-manual-Document-org-babel-tangle-finished-hook.patch >From 167d548bf0e3434aab7af40826f7f31b8174ea27 Mon Sep 17 00:00:00 2001 From: TEC Date: Sun, 28 Aug 2022 01:29:56 +0800 Subject: [PATCH 2/3] manual: Document org-babel-tangle-finished-hook * etc/ORG-NEWS: Mention new hook, `org-babel-tangle-finished-hook'. * doc/org-manual.org (Tangle hooks): Mention new hook, `org-babel-tangle-finished-hook'. --- doc/org-manual.org | 4 ++++ etc/ORG-NEWS | 35 +++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index a37b8390c..2481d81e9 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -18592,6 +18592,10 @@ *** Tangle hooks ~org-babel-tangle~, making it suitable for post-processing, compilation, and evaluation of code in the tangled files. +- ~org-babel-tangle-finished-hook~ :: + #+vindex: org-babel-tangle-finished-hook +This hook is run after post-tangle hooks, in the original buffer. + *** Jumping between code and Org :PROPERTIES: :UNNUMBERED: notoc diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index a7f32671e..d6f77ced8 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -297,6 +297,13 @@ Use the header argument =:var x=code-block[]= or : #+CALL: fn(x=code-block[]) to pass the contents of a named code block as a string argument. +*** New ~org-babel-tangle-finished-hook~ hook run at the very end of ~org-babel-tangle~ + +This provides a proper counterpart to ~org-babel-pre-tangle-hook~, as +~org-babel-post-tangle-hook~ is run +per-tangle-destination. ~org-babel-tangle-finished-hook~ is just run +once after the post tangle hooks. + ** New options *** New custom settings =org-icalendar-scheduled-summary-prefix= and =org-icalendar-deadline-summary-prefix= @@ -5407,21 +5414,21 @@ See https://orgmode.org/elpa/ ** Overview of the new keybindings - | Keybinding | Speedy | Command | - |-----------------+--------+-----------------------------| - | =C-c C-x C-z= | | [[doc::org-clock-resolve][org-clock-resolve]] | - | =C-c C-x C-q= | | [[doc::org-clock-cancel][org-clock-cancel]] | - | =C-c C-x C-x= | | [[doc::org-clock-in-last][org-clock-in-last]] | - | =M-h= | | [[doc::org-mark-element][org-mark-element]] | - | =*= | | [[doc::org-agenda-bulk-mark-all][org-agenda-bulk-mark-all]] | - | =C-c C-M-l= | | [[doc::org-insert-all-links][org-insert-all-links]] | + | Keybinding | Speedy | Command | + |-----------------+--------+-------------------------------------------------------------------| + | =C-c C-x C-z= | | [[doc::org-clock-resolve][org-clock-resolve]] | + | =C-c C-x C-q= | | [[doc::org-clock-cancel][org-clock-cancel]] | + | =C-c C-x C-x= | | [[doc::org-clock-in-last][org-clock-in-last]] | + | =M-h= | | [[doc::org-mark-element][org-mark-element]] | + | =*= | | [[doc::org-agenda-bulk-mark-all][org-agenda-bulk-mark-all]] | + | =C-c C-M-l= | | [[doc::org-insert-all-links][org-insert-all-links]] | | =C-c C-x C-M-v= | | [[doc::org-redisplay-inline-images][org-redisplay-inline-images]] | - | =C-c C-x E= | =E= | [[doc::org-inc-effort][org-inc-effort]] | - | | =#= | [[doc::org-toggle-comment][org-toggle-comment]] | - | | =:= | [[doc::org-columns][org-columns]] | - | | =W= | Set =APPT_WARNTIME= | - | =k= | | [[doc::org-agenda-capture][org-agenda-capture]] | - | C-c , | , | [[doc::org-priority][org-priority]] | + | =C-c C-x E= | =E= | [[doc::org-inc-effort][org-inc-effort]] | + | | =#= | [[doc::org-toggle-comment][org-toggle-comment]] | + | | =:= | [[doc::org-columns][org-columns]] | + | | =W= | Set =APPT_WARNTIME= | + | =k= | | [[doc::org-agenda-capture][org-agenda-capture]] | + | C-c , | , | [[doc::org-priority][org-priority]] | ** New package and Babel language -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-manual-Note-undocumented-tangle-hooks.patch >From e64db8ee8e888fa266331d1b36e5765d6d7d880f Mon Sep 17 00:00:00 2001 From: TEC Date: Sat, 17 Sep 2022 17:59:59 +0800 Subject: [PATCH 3/3] manual: Note undocumented tangle hooks * doc/org-manual.org (Tangle hooks): Note that the pre-tangle and tangle-body hooks are undocumented. --- doc/org-manual.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/org-manual.org b/doc/org-manual.org index 2481d81e9..aafc92d1d 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -18585,6 +18585,8 @@ *** Tangle hooks :UNNUMBERED: notoc :END: +# FIXME missing pre-tangle and tangle-body hooks + - ~org-babel-post-tangle-hook~ :: #+vindex: org-babel-post-tangle-hook -- 2.37.1 --=-=-=--