summaryrefslogtreecommitdiff
path: root/modules/emacs/org.nix
blob: f795dddd9433f31140e31f56c368e2208f1b7b4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
{ callPackage, from-elisp }: {
  org-tangle = block-predicate: text: let
    blocks = (callPackage from-elisp { }).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); 
}