Re: putting stuff from custom.el into init.el
Michael Heerdegen <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
Gfp <[email protected]> writes: > Hi, > > if I want to put e.g. > > '(custom-enabled-themes '(leuven)) > > into my init.el > > what would it look like in my init.el file? What would I have > to change? Note that what you pasted is not a complete expression since you have omitted the context. > Can I simply copy the content of a custom.el file into my > init.el file and delete the content of my custom.el file? > > Or what would I have to do to get the settings into my init.el > file? The first thing to mention is that custom.el contains valid Emacs Lisp code, so in theory, you could just copy the expressions of the file to any other configuration file and they would evaluate normally. BUT the second important thing is: custom.el is automatically edited by Emacs in several different situations, for different purposes, and not only when using the customize interface. You should keep the file, and you should keep its main structure and layout and all parts that you don't understand, and all parts that don't obviously belong to some configuration you created manually. Most things that are in the `custom-set-variables' part of the custom file can be transferred as a respective `setopt' expression. For example, if you have (custom-set-variables ... '(message-log-max t) .... ) you would add (setopt message-log-max t) to your configuration and delete the line '(message-log-max t) from your custom file. Note that some lines may require adding a quote before the value. If you for example have '(background-mode dark) the value is implicitly quoted, and the respective expression would be (setopt background-mode 'dark) because 'dark' is not a variable. I would advise you to proceed gradually and start with simple things. And double check you introduce no errors. And you should leave things that involve custom themes untouched for now because the handling of custom theme settings is not trivial and you should definitely understand what you are doing. The custom file machinery involves more than only setting plain variables. A final thing to mention: obviously your settings will be evaluated in a different order after your transformation, so even if you replace everything by equivalent expressions you still might run into problems when your code refers to any (other) settings. Keep that in mind. Hope that helps, Michael.