/with-emacs.sh

Script to easily run Emacs with specified configurations

Primary LanguageShellGNU General Public License v3.0GPL-3.0

with-emacs.sh

This script makes it easy to run Emacs with alternative configurations (i.e. not ~/.emacs.d). For example, to run Emacs with a configuration stored in ~/new-emacs.d, simply run:

$ with-emacs.sh --dir ~/new-emacs.d

It can also use temporary, “sandbox” directories that are automatically created and then removed after Emacs exits: just run with-emacs.sh without specifying a directory.

It’s helpful for developing packages, troubleshooting configuration problems, trying out alternative configurations, etc.

Contents

Installation

Copy with-emacs.sh into your PATH (or don’t, and run it from wherever you want).

Usage

with-emacs.sh [OPTIONS] [EMACS-ARGS]

Run Emacs with a specified configuration directory.  If no directory
is specified, a temporary one is made with "mktemp -d" and removed
when Emacs exits.

Options
  --debug     Show debug information and don't remove temp directory.
  -h, --help  This.
  --          Optionally used to separate script arguments from
              Emacs arguments.

  -d, --dir   DIR            Use DIR as user-emacs-directory.
  -e, --emacs PATH           Run Emacs executable at PATH.

  -i, --install PACKAGE      Install PACKAGE.
  -O, --no-org-repo          Don't use the orgmode.org ELPA repo.
  -P, --no-package           Don't initialize the package system.
  -R, --no-refresh-packages  Don't refresh package lists.

Changelog

0.1.2

Changes

0.1.1

Fixes

  • Argument -e / --emacs.

0.1

First tagged version. Renamed from emacs-sandbox.sh.

Credits

Inspired by and some code copied from MELPA’s Makefile.

Alternatives

  • Chemacs2 is a system of three Elisp files designed to replace your ~/.emacs.d and switch between “profiles” stored in other directories. It requires a configuration file pointing to the profiles’ directories. It offers some additional functionality, like setting environment variables per-profile.
    • In contrast, with-emacs.sh does not replace anything, and it requires no configuration; just run it with a directory of your choice. It’s just a Bash script, so if you want to set an environment variable, use standard tools, like env.

Development

Bug reports, feature requests, suggestions — oh my!

License

GPLv3