Skip to content

Commit 6a82d17

Browse files
committed
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'. (org-babel-pre-tangle-hook): Update docstring to mention buffer the hook is run in, to match the docstring of `org-babel-tangle-finished-hook`.
1 parent d240386 commit 6a82d17

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lisp/ob-tangle.el

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ then the name of the language is used."
7878
:type 'hook)
7979

8080
(defcustom org-babel-pre-tangle-hook '(save-buffer)
81-
"Hook run at the beginning of `org-babel-tangle'."
81+
"Hook run at the beginning of `org-babel-tangle' in the original buffer."
8282
:group 'org-babel
8383
:version "24.1"
8484
:type 'hook)
@@ -89,6 +89,13 @@ then the name of the language is used."
8989
:version "24.1"
9090
:type 'hook)
9191

92+
(defcustom org-babel-tangle-finished-hook nil
93+
"Hook run at the very end of `org-babel-tangle' in the original buffer.
94+
In this way, it is the counterpart to `org-babel-pre-tangle-hook'."
95+
:group 'org-babel
96+
:package-version '(Org . "9.6")
97+
:type 'hook)
98+
9299
(defcustom org-babel-tangle-comment-format-beg "[[%link][%source-name]]"
93100
"Format of inserted comments in tangled code files.
94101
The following format strings can be used to insert special
@@ -322,6 +329,7 @@ matching a regular expression."
322329
(org-babel-with-temp-filebuffer file
323330
(run-hooks 'org-babel-post-tangle-hook)))
324331
path-collector))
332+
(run-hooks 'org-babel-tangle-finished-hook)
325333
path-collector))))
326334

327335
(defun org-babel-interpret-file-mode (mode)

0 commit comments

Comments
 (0)