Sebastian Wiesner over at lunarsite has an excellent tutorial on scripting with Emacs. By “scripting with Emacs” he means we’d like to have a shell script containing some Elisp or a reference to a file containing some Elisp into which we can pass some arguments and have the script call Emacs and execute the Elisp with the arguments. It turns out to be trickier than you might think.
We all know about --script
and --batch
but there are a lot of corner cases that Wiesner explores. The problem, as he explains, is that Emacs is really an editor and attempts to use it as a general scripting language brings difficulties.
If you’re interested at all in scripting with Emacs, Wiesner’s post is a must read. Even if you’re not interested right now, it’s worth taking a look and bookmarking it for later.