Solved emacs initialization file

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

The emacs initialization file states:

When Emacs is started, it normally tries to load a Lisp program from an initialization file, or init file for short. This file, if it exists, specifies how to initialize Emacs for you. Traditionally, file ~/.emacs is used as the init file, although Emacs also looks at ~/.emacs.el, ~/.emacs.d/init.el, ~/.config/emacs/init.el, or other locations. See Find Init.

You may find it convenient to have all your Emacs configuration in one directory, in which case you should use ~/.emacs.d/init.el or the XDG-compatible ~/.config/emacs/init.el.

On my system I do not have any of ~/.emacs ~/.emacs.el ~/.emacs.d/init.el ~/.config/emacs/init.el.

I do have a ~/.emacs.d/init.el but that only has an auto-save-list directory in it.

Somehow when in emacs I can run M-x load-theme and can load manoj-dark successfully. Such a theme is in the themes directory with /usr/local/share/emacs/27.2/etc

So what is the linkage between emacs and this directory? Is it hardcoded as I don't see any way the theme can be picked up.
 

fraxamo

Member

Reaction score: 61
Messages: 75

You should find everything you need to know about the emacs initialisation file at this link.
 

fraxamo

Member

Reaction score: 61
Messages: 75

Apologies. Here's the correct excerpt from the emacs manual [0]:

"By default, Emacs looks for theme files in two locations: the directory specified by the variable custom-theme-directory (which defaults to ~/.emacs.d/), and a directory named etc/themes in your Emacs installation (see the variable data-directory). The latter contains several Custom themes distributed with Emacs that customize Emacs’s faces to fit various color schemes."

So, to see what the variable 'data-directory' points to you can run the following command in the *scratch buffer:

'(print data-directory)', highlight it and hit Ctrl-j

In my version of emacs it returns the path "/usr/local/share/emacs/27.1/etc/", the same as you.

[0] https://www.gnu.org/software/emacs/manual/html_node/emacs/Custom-Themes.html
 

bobmc

Member

Reaction score: 33
Messages: 81

Does it work from the options menu:?
Options -> Customize Emacs -> Custom Themes
I like "wombat" because it is dark brown, easy on eyes without blue light
 

fbbxf4

New Member


Messages: 3

Does it work from the options menu:?
Options -> Customize Emacs -> Custom Themes
I like "wombat" because it is dark brown, easy on eyes without blue light
Yes, it does. I just tried it and wombat. In Custom Themes, I checked the theme I wanted to try. In that buffer on my machine, there's a button for Save Theme Settings. It updated my .emacs to load wombat theme. I killed emacs, started again, and had wombat theme.
 
Top