box.matto.nl
Enjoying Open Source Software

Set up an alternative Emacs configuration

Using Emacs traditionally results in the long-lasting cultivation of a personal configuration.

To try out some alternative configuration, I usually create a playing field by setting up an extra, dedicated user-account on my system, using "su - " to enter the playground.

Emacs 29

The release of Emacs 29 provides a better way to do this.

The NEWS.29 file states:

Emacs now supports setting 'user-emacs-directory' via '--init-directory'.

We can use of this to set up an alternative configuration.

Separate playground

To create a new playground, I set up a directory ~/.alt-emacs.d,

The init.el file inside this directory starts as follows:

;; -*- lexical-binding: t; -*-

(setopt user-emacs-directory "~/.alt-emacs.d/")

The result is a separated environment.

Emacs will use the user-emacs-directory in the same way it uses your ~/.emacs.d/ in the "normal" environment.

For example, when installing packages, Emacs will create the directory ~/.alt-emacs.d/elpa. The packages of your "normal" Emacs configuration are not affected by whatever you do in the playground. Likewise, files like abbrev_defs, custom.el and so on are stored in the alternative user-emacs-directory.

Usage of the playground

Start Emacs with the --init-dir switch:

emacs --init-dir "~/.alt-emacs.d/"

And have all the fun of crafting a new Emacs configuration and do all kind of experimenting.

Tags:

⇽ This website is available without encryption, and yours should be too


Made with ♥ by a human — no cookies, no trackers.
Proud member of the 250kb.club, the no-JS.club, the Blogroll.Club, and the Bukmark.Club.
Don’t let a billionaire’s algorithm control what you read — use an RSS feed reader.