Skip to content

Blog Zero

11 Feb 2022

Quickly Tangling

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

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 org-babel-tangle-file 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 file.

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!

Tags: emacs sed software