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.

  1. 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)
  2. 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

Tory Anderson avatar
Tory Anderson
Web App Engineer, Digital Humanist, Researcher, Computer Psychologist