2

Currently all my settings that come from the customize interface are placed in:

(custom-set-variables '(menu-bar-mode nil) '(ivy-mode t) '(blink-cursor-mode nil) '(hl-line-mode nil) '(inhibit-startup-buffer-menu t) '(inhibit-startup-screen t) '(initial-scratch-message nil) '(scroll-bar-mode nil) '(show-paren-mode t) '(tool-bar-mode nil) ) 

However, these settings eventually get buried inside the auto generated code that accumulates over time.

I would like to move some of these settings outside of the customize-interface into their own dedicated section so that I can keep track of them easily.

From what I understand I can't create a second custom-set-variables section because that's reserved for the auto generated code.

I don't know elisp well enough to know how to do this effectively.

Some guides suggest placing this anywhere in the init file:

(menu-bar-mode -1) 

I've also seen this version:

(menu-bar-mode 0) 

But this doesn't seem to work for all settings and some of them just give errors at startup. like this one for example:

(ivy-mode 1) 

Results in:

Symbol's function definition is void: ivy-mode 

So what is the right way to organize settings outside of the customize-interface?

And how do these formats differ? -1 0 1 t nil etc.

** Answer in comments.

4
  • You'd need to require the correct package before activating the mode. Additionally, if you want to learn more about the arguments that the function can take, you can hit M-x describe-function RET RET while on the function's name. Commented Dec 25, 2016 at 10:16
  • This helped a little. It says that positive arguments enable the mode and anything else disables it. So I'm guessing -1 and 0 are the same thing. It says if called from lisp, the mode is disabled if the argument is nil or omitted which explains the nil and t from the customize section. I'm still a little unsure as to what's the difference between '(function t) and (function 1) isn't everything in the init file just Lisp? Commented Dec 25, 2016 at 14:00
  • In a way, you are confusing variables and functions; the custom-set-variable function sets… variables! But really, this is slightly more complicated, since setting, say, menu-bar-mode to 1 wouldn't have any effect but customizing it would. And yes, everything is just Lisp. Commented Dec 25, 2016 at 14:16
  • @Michaël Thanks, I was indeed confusing variables an functions. I had to use (menu-bar-mode 0) for functions and (setq-default initial-scratch-message nil) for variables. Thanks again. Commented Dec 25, 2016 at 14:26

1 Answer 1

5

Set variable custom-file. If defined, that is the file the Customize uses, to save and update your custom settings, instead of using your init file (e.g. ~/.emacs). Just add this to your init file:

(setq custom-file "/LOCATION/OF/YOUR/INIT/FILE/FILENAME") 

And load that file at an appropriate place in your init file:

(load-file custom-file) 

This lets you reserve your init file for Lisp customizations/settings that you make. It keeps Customize out of your init file, so the two of you don't step on each other. (Everyone should use custom-file (or some similar mechanism), IMHO.)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.