mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-28 10:56:57 +00:00
org-babel-post-tangle-hook run in code files tangled by `org-babel-tangle'
* lisp/ob-tangle.el (org-babel-post-tangle-hook): adding hook which can be used to call functions from inside of code files tangled by org-babel-tangle (org-babel-tangle): added call to org-babel-post-tangle-hook
This commit is contained in:
parent
19e98b1b0f
commit
abcb76891b
@ -47,6 +47,11 @@ then the name of the language is used."
|
||||
(string "Language name")
|
||||
(string "File Extension"))))
|
||||
|
||||
(defcustom org-babel-post-tangle-hook nil
|
||||
"Hook run in code files tangled by `org-babel-tangle'."
|
||||
:group 'org-babel
|
||||
:type 'hook)
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-load-file (file)
|
||||
"Load the contents of the Emacs Lisp source code blocks in the
|
||||
@ -138,7 +143,7 @@ exported source code blocks by language."
|
||||
(delete-file file-name))
|
||||
;; drop source-block to file
|
||||
(with-temp-buffer
|
||||
(if (fboundp lang-f) (funcall lang-f))
|
||||
(when (fboundp lang-f) (funcall lang-f))
|
||||
(when (and she-bang (not (member file-name she-banged)))
|
||||
(insert (concat she-bang "\n"))
|
||||
(setq she-banged (cons file-name she-banged)))
|
||||
@ -160,6 +165,13 @@ exported source code blocks by language."
|
||||
(org-babel-tangle-collect-blocks lang))
|
||||
(message "tangled %d code block%s" block-counter
|
||||
(if (= block-counter 1) "" "s"))
|
||||
;; run `org-babel-post-tangle-hook' in all tangled files
|
||||
(when org-babel-post-tangle-hook
|
||||
(mapc
|
||||
(lambda (file)
|
||||
(with-temp-filebuffer file
|
||||
(run-hooks 'org-babel-post-tangle-hook)))
|
||||
path-collector))
|
||||
path-collector)))
|
||||
|
||||
(defun org-babel-tangle-clean ()
|
||||
|
Loading…
Reference in New Issue
Block a user