Note: there is a public repository that includes the source code for the program that this post is about.
This is a brief post about a short
sed script I wrote called
org-quick-tangle that can very quickly tangle an org mode file, but that
works properly only on certain files. Specifically, it
- only respects
:tangleheader arguments on source blocks (that is, on
#+begin_srclines) and completely ignores any others, such as those specified in properties drawers,
- writes all of the code blocks (that it doesn't omit) to its standard output, ignoring any destination file that may have been specified for them, and
- does some special handling of anything that looks like a Lisp comment line (though it's very unlikely that this handling will have any effect on tangled source code that's written in non-Lisp languages).
While it should work to tangle any source code within the limitations outlined above, the primary reason I created it — and the only thing I use it for currently — is to generate an Emacs Lisp file from my literate Emacs configuration.
How fast is it? On my not overly powerful desktop machine it tangles my 1.4MB
kitchen-sink org mode configuration file into the corresponding 627KB Emacs
Lisp file in about 40 milliseconds, which is all but instantaneous. In
comparison, on the same machine the script that uses
to do the tangling takes about 2 minutes. However, the slower script's
results do include links back to the org mode file, so I usually use
org-quick-tangle to save time testing my Emacs configuration changes (which
savings can be considerable if I end up having to tangle multiple times) and
then once I'm sure that the changes work correctly I'll use the
org-babel-tangle-file-based script once to tangle the final Emacs Lisp
Hopefully you'll find this
sed script useful in reducing the time you spend
tangling, whether it's your Emacs configuration or some other source code.
If you'd like to support this site then check out my web app InEveryNook.com and see if it's of interest to you, pass it along to anyone you think might be interested in it, or both. Thanks!