Create Minimal Emacs Environments with a Shell Script

Within the last two years, I’ve started to use Emacs more and more in large part due to the writing and note-taking powers of Org-mode.

When I first started to use Emacs, I relied on Spacemacs, which is basically an opinionated configuration that has settings that are useful for someone used to Vim’s way of working with text. (yep, that’s me! Why choose between Emacs and Vim when you can have both!)

At a certain point I wanted to have a better understanding of my editor and in particular, wanted to get a feel for how to approach editing “the Emacs way.” Mostly this means trying new packages or built-in functionality with a minimal amount of cruft.

Since there are useful packages out there, and I don’t want to go and break my existing configuration, I found myself needing a way to quickly create a minimal Emacs sandbox. Something that is quick to scaffold up and just as easy to tear down by deleting a folder.

After a bit of hacking, and the help of this StackOverflow answer, the result is a simple bash script that I’ve pushed to Github:

Usage

The Readme should have more details about using the script, but as a quick intro, here’s what you can expect:

Screen recording of using the emacs-sandbox.sh script to create an Emacs sandbox environment.
emacs-sandbox.sh -i straight -i evil
# Creates the default 'sandbox' environment with the 'straight'
# package manager and 'evil' (ie, vi-style bindings)

emacs-sandbox.sh -n super-secret -i melpa -i straight -i ivy
# Creates the named 'super-secret' environment with the 'melpa'
# package repository configured along with 'straight' for package
# management  and the 'ivy' package for general completion
# functionality.