M-x all-things-emacs

Quick Tip: Detaching the custom-file

December 6th, 2008 by Ryan McGeary · 45 Comments

I’ve never really liked the built-in customization UI in Emacs (M-x customize). I’m sure plenty of people use it and enjoy it, but, to me, it feels like an abominable tree of never ending and difficult to navigate options. Plus, it sticks your saved customizations as an unorganized mess of elisp smack at the bottom of your init file. I’m not quite sure how to solve my first gripe, but the second is manageable.

By setting the custom-file variable, you can keep those automated customizations in a separate file. Put this in your Emacs init:

(setq custom-file "~/.emacs.d/custom.el")
(load custom-file 'noerror)

Both lines are necessary. The first line tells Custom to save all customizations in the file, but does not load it. The 'noerror argument passed to load prevents errors if the file doesn’t exist. If you had existing customizations in your init file, be sure to copy them to the new custom file.

Now, go enjoy a cleaner init file. This tip is especially useful if you keep your init files under a version control system. You do keep your init files under version control, right?

Tags: elisp · quick · tips

45 responses so far ↓

  • 1 me // Dec 7, 2008 at 2:01 pm

    Amen, brudda! And yes, I’ve been keeping my dotfiles in revision control for years … inspired by http://joey.kitenet.net/svnhome/

  • 2 Bob Erb // Dec 8, 2008 at 7:12 pm

    Thank you. I hate that custom cruft, too.

  • 3 Karl Anderson // Dec 9, 2008 at 7:39 pm

    I just have a one-liner .emacs: “(load-library “~/emacs/my-emacs”)”, and let emacs do what it wants with .emacs. A simpler solution IMHO, because it does less – my-emacs.el loads a lot of my-foo.el libraries for various foo, anyway.

  • 4 Gimmmo // Mar 29, 2009 at 12:14 am

    Thanks, you save my day :)

  • 5 coder // Apr 11, 2009 at 11:50 am

    Hello, I am writing a new Java source browser for Emacs, using Pymacs and Python. It’s called PyJDE.

    http://code.google.com/p/pyjde/

    Take a look.

  • 6 Personal Trainer Seattle // Jul 22, 2015 at 12:47 am

    ... [Trackback]

    [...] Read More Infos here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 7 Con-Cret Pre Workout // Jul 23, 2015 at 4:27 pm

    ... [Trackback]

    [...] Find More Informations here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 8 amazin gas station video // Jul 24, 2015 at 8:56 am

    ... [Trackback]

    [...] Find More Informations here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 9 amazin gas station video // Jul 24, 2015 at 10:35 am

    ... [Trackback]

    [...] Read More: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 10 spongebob online // Jul 24, 2015 at 11:44 am

    ... [Trackback]

    [...] Read More: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 11 dwi defense attorney // Jul 24, 2015 at 9:33 pm

    ... [Trackback]

    [...] Read More Infos here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 12 criminal defense lawyers // Jul 24, 2015 at 11:20 pm

    ... [Trackback]

    [...] Read More here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 13 Limo service atlanta // Jul 25, 2015 at 1:59 pm

    ... [Trackback]

    [...] Find More Informations here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 14 locksmith orangevale ca // Jul 26, 2015 at 6:24 am

    ... [Trackback]

    [...] Read More: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 15 Locksmith Rancho Cordova // Jul 26, 2015 at 6:32 am

    ... [Trackback]

    [...] Read More Infos here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 16 Acworth SEO // Jul 27, 2015 at 2:55 pm

    ... [Trackback]

    [...] Read More: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 17 cleaning services London // Jul 27, 2015 at 6:28 pm

    ... [Trackback]

    [...] Read More Infos here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 18 surf store // Jul 28, 2015 at 6:40 am

    ... [Trackback]

    [...] Read More here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 19 http://vmaz.me/rtl-jetzt-kostenlos-im-online-live-stream-gucken-so-gehts/ // Jul 28, 2015 at 9:49 pm

    ... [Trackback]

    [...] Read More: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 20 Insider Binary Bot // Jul 31, 2015 at 3:47 pm

    ... [Trackback]

    [...] Read More Infos here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 21 Prodaja staklene ambalaze // Aug 1, 2015 at 2:37 am

    ... [Trackback]

    [...] There you will find 28850 more Infos: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 22 securitas security // Aug 1, 2015 at 4:09 pm

    ... [Trackback]

    [...] Informations on that Topic: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 23 website here // Aug 2, 2015 at 6:33 pm

    ... [Trackback]

    [...] Read More: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 24 http://optimumcontractors.com // Aug 2, 2015 at 8:26 pm

    ... [Trackback]

    [...] Read More Infos here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 25 tiptoproofers.net // Aug 2, 2015 at 10:26 pm

    ... [Trackback]

    [...] There you will find 42296 more Infos: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 26 certifiedhandymen.net // Aug 3, 2015 at 4:16 am

    ... [Trackback]

    [...] Read More here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 27 site // Aug 3, 2015 at 1:42 pm

    ... [Trackback]

    [...] Read More here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 28 electric furnace repair // Aug 4, 2015 at 1:00 am

    ... [Trackback]

    [...] Find More Informations here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 29 get redirected here // Aug 4, 2015 at 1:35 am

    ... [Trackback]

    [...] Read More: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 30 http://www.tiptopelectric.org // Aug 4, 2015 at 2:11 am

    ... [Trackback]

    [...] Read More here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 31 bathroom renovation companies // Aug 4, 2015 at 2:41 am

    ... [Trackback]

    [...] Informations on that Topic: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 32 http://www.selectcontractors.net // Aug 5, 2015 at 7:14 am

    ... [Trackback]

    [...] There you will find 63369 more Infos: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 33 www.skillfullcontrcting.com // Aug 5, 2015 at 10:40 am

    ... [Trackback]

    [...] Informations on that Topic: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 34 have a peek here // Aug 9, 2015 at 6:20 pm

    ... [Trackback]

    [...] There you will find 29686 more Infos: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 35 useful source // Aug 9, 2015 at 6:48 pm

    ... [Trackback]

    [...] Informations on that Topic: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 36 buy backlinks // Aug 10, 2015 at 10:18 pm

    ... [Trackback]

    [...] There you will find 38789 more Infos: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 37 check these guys out // Aug 10, 2015 at 10:18 pm

    ... [Trackback]

    [...] Informations on that Topic: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 38 ttt4 // Aug 10, 2015 at 10:32 pm

    ... [Trackback]

    [...] There you will find 75227 more Infos: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 39 find here // Aug 12, 2015 at 10:22 pm

    ... [Trackback]

    [...] Read More here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 40 My house is very old. What should I do about the outdated wiring? // Aug 13, 2015 at 11:49 pm

    ... [Trackback]

    [...] Read More: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 41 this // Aug 14, 2015 at 12:02 am

    ... [Trackback]

    [...] Read More: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 42 inerior painting // Aug 14, 2015 at 4:31 am

    ... [Trackback]

    [...] There you will find 25584 more Infos: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 43 Do I need to be home when my gutters are cleaned? // Aug 14, 2015 at 4:51 am

    ... [Trackback]

    [...] Read More: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 44 http://www.principalwindows.com // Aug 14, 2015 at 4:55 am

    ... [Trackback]

    [...] Informations on that Topic: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]

  • 45 shed removal company // Aug 14, 2015 at 7:35 am

    ... [Trackback]

    [...] Read More Infos here: emacsblog.org/2008/12/06/quick-tip-detaching-the-custom-file/ [...]