feat(confpkg): restrict initialization hook
Restrict the babel calls triggered during tangling to those containing "confpkg" in their name, rather than all babel call statements.
This commit is contained in:
parent
e2ae7b0736
commit
5861e16b92
|
@ -119,9 +119,10 @@ Luckily, I don't need to be able to understand code in order to do what I do bes
|
|||
|
||||
If you're reading the raw org file instead of the published version, the code for =confpkg= is below. It is mostly unchanged, aside from these tweaks:
|
||||
|
||||
- Prevent =confpkg='s code from being exported
|
||||
- Change the package template to contain my information
|
||||
- Reorganize to get rid of superfluous noweb references
|
||||
- Prevent the code from being exported
|
||||
- Hook into only babel calls that contain =confpkg= as a substring
|
||||
- Allow package statements anywhere in subconfig files, rather than only at the beginning
|
||||
|
||||
** confpkg :noexport:
|
||||
|
@ -135,8 +136,10 @@ If you're reading the raw org file instead of the published version, the code fo
|
|||
(message "Intitialising confpkg")
|
||||
(org-fold-core-ignore-fragility-checks
|
||||
(org-babel-map-executables nil
|
||||
(when (eq (org-element-type (org-element-context)) 'babel-call)
|
||||
(org-babel-lob-execute-maybe)))))
|
||||
(let ((context (org-element-context)))
|
||||
(and (eq (org-element-type context) 'babel-call)
|
||||
(string-match-p "confpkg" (org-element-property :call context))
|
||||
(org-babel-lob-execute-maybe))))))
|
||||
(quit (revert-buffer t t t)))
|
||||
#+end_src
|
||||
|
||||
|
|
Loading…
Reference in a new issue