summaryrefslogblamecommitdiff
path: root/modules/emacs/org.nix
blob: e5fd15c4758dcb649db528af90877fd6618c3885 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
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); 
}