Malabarba
Malabarba

Reputation: 4553

Save "custom-set-variables" with elisp

If I bring up emacs' customization interface, edit a variable, and then set+save it, its new value gets stored in a (custom-set-variables ...) list in my init file.

Now, let's say I modified a variable's value in elisp (using (setq ...) or something else).

How can I save this new value to the (custom-set-variables ...) list using elisp instead of the interactive interface?

Upvotes: 9

Views: 3087

Answers (3)

Drew
Drew

Reputation: 30701

Yes, customize-save-variable is your friend. See also http://www.emacswiki.org/emacs/CustomizingAndSaving about the relation between (a) making changes to options and faces and (b) saving them.

Upvotes: 1

Andreas Röhler
Andreas Röhler

Reputation: 4804

The value of `custom-file' says where your customizations are stored. It's a plain Emacs Lisp, e.i. text file. You may change the values there from any program, creating an elisp command or change it from outside via sed, perl, python, emacs-batch mode etc.

Upvotes: 0

juanleon
juanleon

Reputation: 9380

Looks like you are looking for customize-save-variable

Upvotes: 8

Related Questions