Batch Mode

If you’re an even moderately experienced Emacs user, you probably know about batch mode. You can write a file with some Emacs commands and run it either by calling Emacs on the command line with a --script parameter pointing to the file or by adding at #! line to the top of the script and running it by calling the script directly.

Emacs Elements has a short video on batch mode that describes a use case I hadn’t seen before. The video is only 5 minutes, 45 seconds so you can watch it to get the details but the TL;DR is that you can use batch mode to check a changed init.el file for errors.

The idea is that you use batch mode to load the modified init.el file. If there are any errors, you get notified but your active Emacs instance is still operable. It’s preferable to just restarting Emacs because if there’s a disabling error, you still have a working Emacs to correct it. Sure, you could always restart Emacs with a -q or -Q option but then you don’t really have a fully operational Emacs to work with. That happens to me a lot when I have an error in my init.el. I can get by, of course, but it’s a pain. With Emacs Elements’ method you still have your familiar and comfortable working environment available.

This entry was posted in General and tagged . Bookmark the permalink.