cus-edit+ Is the Best Emacs Module You’ve Never Used

04 January 2014

I have declared .emacs bankruptcy for 2014. I’ve wanted a simple, extensible Emacs configuration for some time now. On the way to that goal, I discovered a module that’s made it easier, and has changed how I think about Emacs configuration.

Drew Adams is the insanely productive programmer behind Icicles and DoReMi, and countless other Emacs contributions. He is absolutely prolific on the EmacsWiki, tirelessly responding to other users and providing support. In short, he’s a model community member. He’s also the author of cus-edit+.

Its goal is simple: to unify the changes you make both outside and inside Emacs’ Customize system. The results, however, are phenomenal. Huge swaths of my disorganized .emacs.d should have been tracked by Customize.

Here’s a file hidden in my mess of an .emacs.d directory called misc.el:

(setq
    backup-by-copying t
    backup-directory-alist '(("." . "~/.emacs.d/saves"))
    delete-old-versions t
    kept-new-versions 6
    kept-old-versions 2
    version-control t
    ido-enable-prefix nil
    ido-enable-flex-matching t
    ido-create-new-buffer 'always
    ido-use-filename-at-point 'guess
    ido-max-prospects 10)

If you’re like me, this should look familiar. Undocumented detritus with a useless filename, multiple modifications to seemingly unrelated variables.

Here’s what it looks like after using cus-edit+:












Those settings are now in my custom-file. I can M-x customize-saved, and I get their name, their description, their current value, and what group they belong to.

As I go through my old .emacs.d directory:

  1. I find settings that I know I want and execute them.
  2. I use cus-edit+ to update its repertoire of modified custom variables, by M-x customize-update-all-vars.
  3. Then I M-x customize-customized—another cus-edit+ function—to bring all those modified settings into one customize page, so I can review and set them.

It’s basically painless. It doesn’t solve all my problems with Customize (another entry entirely) but it takes huge strides towards finally mopping up the mess that brought me to .emacs bankruptcy in the first place.

Give cus-edit+ a go: It’s available on Melpa, as well as the EmacsWiki. Find all those random setqs cluttering up your Emacs configuration, and get them where they belong.