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`.
This commit is contained in:
TEC 2022-08-27 11:15:23 +08:00
parent d240386c10
commit 6a82d17c89
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 9 additions and 1 deletions

View File

@ -78,7 +78,7 @@ then the name of the language is used."
:type 'hook) :type 'hook)
(defcustom org-babel-pre-tangle-hook '(save-buffer) (defcustom org-babel-pre-tangle-hook '(save-buffer)
"Hook run at the beginning of `org-babel-tangle'." "Hook run at the beginning of `org-babel-tangle' in the original buffer."
:group 'org-babel :group 'org-babel
:version "24.1" :version "24.1"
:type 'hook) :type 'hook)
@ -89,6 +89,13 @@ then the name of the language is used."
:version "24.1" :version "24.1"
:type 'hook) :type 'hook)
(defcustom org-babel-tangle-finished-hook nil
"Hook run at the very end of `org-babel-tangle' in the original buffer.
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]]" (defcustom org-babel-tangle-comment-format-beg "[[%link][%source-name]]"
"Format of inserted comments in tangled code files. "Format of inserted comments in tangled code files.
The following format strings can be used to insert special The following format strings can be used to insert special
@ -322,6 +329,7 @@ matching a regular expression."
(org-babel-with-temp-filebuffer file (org-babel-with-temp-filebuffer file
(run-hooks 'org-babel-post-tangle-hook))) (run-hooks 'org-babel-post-tangle-hook)))
path-collector)) path-collector))
(run-hooks 'org-babel-tangle-finished-hook)
path-collector)))) path-collector))))
(defun org-babel-interpret-file-mode (mode) (defun org-babel-interpret-file-mode (mode)