summaryrefslogtreecommitdiff
path: root/modules/emacs/org.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/emacs/org.nix')
-rw-r--r--modules/emacs/org.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/emacs/org.nix b/modules/emacs/org.nix
new file mode 100644
index 0000000..e5fd15c
--- /dev/null
+++ b/modules/emacs/org.nix
@@ -0,0 +1,11 @@
+{ pkgs, from-elisp }: {
+ org-tangle = block-predicate: text:
+ let blocks = (pkgs.callPackage from-elisp { inherit pkgs; }).parseOrgModeBabel text;
+ block-to-str = (block:
+ if block-predicate { inherit (block) language flags; } then
+ block.body
+ else
+ ""
+ );
+ in builtins.concatStringsSep "\n" (map block-to-str blocks);
+}