emacs-twist / org-babel

A pure Nix implementation of org-babel-tangle
MIT License
15 stars 1 forks source link

choose tangle header #5

Closed jordanisaacs closed 4 months ago

jordanisaacs commented 4 months ago

Allow choosing tangle header (e.g. :tangle init.el)

akirak commented 4 months ago

So, you want to export your configuration to init.el which is not the default output file, using org-babel-tangle Emacs Lisp function? You also want to parse the configuration in Nix?

This Nix library can generate an Emacs Lisp file, as written in the readme:

tangleOrgBabelFile Similar to tangleOrgBabel, but this function takes a file as an argument and writes the output to a file.

Is there any reason you don't want to load the Nix-generated init.el at Emacs startup? Alternatively, you could tangle your Org file using Emacs and then source its output to Nix. You can choose either of them, and this PR probably won't be necessary.

Although the change you suggested is technically trivial, I would like to hear your use case.

jordanisaacs commented 4 months ago

I have an init.org that generates both an early-init.el and an init.el. So they use :tangle filename. I then used tangleOrgBabelFile with this PR to only generate the init.el.

https://github.com/jordanisaacs/emacs-config/blob/master/flake.nix

akirak commented 4 months ago

I see. The content itself looks good. Merged.