From 5861e16b922c5170388491460bb6f9249006b2c5 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Mon, 22 Jul 2024 12:27:46 -0400 Subject: [PATCH] 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. --- config.org | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config.org b/config.org index f9114ec..889772f 100644 --- a/config.org +++ b/config.org @@ -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