Re: putting stuff from custom.el into init.el
Gfp <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
thanks very much for your explanation, I am slowly learning Michael Heerdegen <[email protected]> writes: > 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. Yes, you are right, I just realised this yesterday, when I was looking at my custom.el file. this is the start of my custom.el file: I forgot to copy the first part: (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(ansi-color-faces-vector [default default default italic underline success warning error]) '(ansi-color-names-vector ["#2e3436" "#a40000" "#4e9a06" "#c4a000" "#204a87" "#5c3566" "#729fcf" "#eeeeec"]) '(apropos-sort-by-scores 'verbose) '(bmkp-last-as-first-bookmark-file "/home/gfp/.config/emacs/bookmarks") '(canlock-password "db31707d96ca42cbc9051edf483754111b0e59b8") '(column-number-mode t) '(custom-enabled-themes '(leuven)) '(custom-safe-themes '("535f3728bfce79a9cfcd2a841385a63831a8a292231eed7ec8dec134af430061")) '(dired-hide-details-hide-information-lines nil) '(dired-listing-switches "-al") '(diredp-hide-details-initially-flag nil) '(display-time-mode t) '(electric-quote-mode t) '(global-dired-hide-details-mode nil) '(global-display-fill-column-indicator-mode nil) '(global-display-line-numbers-mode t) > 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. I have created a second user on my laptop and I can use that second user to learn about Emacs. I want to set up an Emacs from scratch in which I want to sort out the whole thing, I like order and overview, and if possible to put almost everything in one file. 1. I have to install Emacs 2. I have to install Emacs packages. probably through „manage emacs packages“ in emacs 3. I create a file in which I have to put my settings. - Can it be a file with the ending „.org“? - or does it need to have an „.el“ ending like init.el? - or I have to create an .el file and an .org file and put something in the .el file that it loads the custom.el file and the .org file in case I want an .org file? How to proceed? - Many people have a init.el file and put everything there. - It is easy to set something up with „customize Emacs“ and it will be in the custom.el file but then I have again several files, which I wouldn´t prefer. So my question is how can I set up something without „customize emacs“ „custom.el“? I would need to know the code! How can I find that code for my personal settings which are now in custom.el? I can´t create code myself yet. Emacs takes very long time to learn? thanks Gottfried