1

I have a general emacs.org file that I load at init time with org-babel. It's made for desktop use, and I load a bunch of IDE features, face customizations, powerline and so on. However, I also sometimes use emacs on a headless server, where such configurations don't make sense but still take time loading (especially since the server is much less powerful than my desktop). But I would still like to keep other blocks (e.g. ivy, undo-tree etc). I could just take my emacs.org and delete unnecessary blocks when putting it on my server, but now I have two different files to manage, which is a pain.

Is there a way to tell org-babel "only load these code blocks"? For example by filtering tags of headers?

1

I think this is pretty easy to do. :tangle can take no or yes, a filename, but also a lisp function. For example:

#+BEGIN_SRC bash :tangle (make-string 5 ?x)
ls -tr
#+END_SRC

Recall that header arguments can be set at different levels (for example as a +#PROPERTY under a headline) so you can have headlines for different OS, hosts, etc. Create a function that, based on the hostname, returns either emacs.el or no. When it returns no that block won't be tangled.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.