Migrating to a custom-file-less setup
Table of Contents
I love the advocacy for a custom-less setup given here. Mind you, I have no desire to go without the customization family of helper commands like customize-group
and customize-variable
: the ability to rapidly explore the options available for plugins, libraries, and styles feels like a “killer feature”. But as software engineering has grown over the decades we are in a place to better understand the values in locating those customization in the same place where they can be associated, shared, and simultaneously deleted/edited. For example, when someone asks “How did you get XX to do/look like that?” it can demanding to figure out what customizations you’ve made.
However, I encountered two main hangups in my attempt to migrate.
- Where to I customize global things that don’t align with a package? Things like window divider, visible bell, and scroll-bar-mode? (since my customizations go in :custom lines in Straight/Use-Package)
- How do I customize faces, not variables?
The promise is for a more reproducible config that can stay in step with the actual packages I’m using (instead of a bloat of old customized things that just stick around when I’ve moved on from their packages). The counter-argument, though, is that going configuration-file-less means you no longer benefit from the configure-
family of commands.
Answer 1: use-package emacs
Although I struggled to find documentation on this, here’s the way for package-less customization. However, many things are actually built-in packages, so check them out with describe-variable
and make sure they don’t come from built-in c-code so you can locate them with their package.
(use-package emacs
:straight (:type built-in)
:custom
;; for example:
(backup-directory-alist '((".*" . "~/emacs/.emacs.d/temporary_files"))))
Answer 2: :custom-face
Although I knew about :custom
, I didn’t realize that you can do the very same thing with :custom-face
(adding as many new lists after the keyword as you like). Note that some things derived from custom files might suggest syntax with a quoted list of lists, like (default '((...)))
. This will fail if you copy it as-is into a :custom-face
section; remove the '
and you should be fine.
:custom-face
(default ((t (:inherit nil :extend nil :stipple nil :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 150 :width normal :foundry "ADBO" :family "Source Code Pro"))))
The Final Piece: telling “no custom file”
Although the original recommendation used cus-edit, that package didn’t actually seem to be available for me so I used cus-edit+. With this I turn off customization-file-saving.
(use-package cus-edit+
:defer t
:custom
(custom-file null-device "Don't store customizations"))
Resources
- This Reddit post: https://www.reddit.com/r/emacs/comments/js9r52/migrating_to_a_customfileless_setup/
- Reddit post amidst conversation of custom file https://www.reddit.com/r/emacs/comments/iqpnx4/how_do_you_use_the_emacscustom_file/g4uf8un?utm_source=share&utm_medium=web2x&context=3
- The use-package organizatonal macro: https://github.com/jwiegley/use-package
- straight.el, a decided move toward a reproducible and orderly package setup (which includes use-package): https://github.com/raxod502/straight.el#integration-with-use-package