Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why cant emacs 24 find a custom theme I added?

My entire emacs setup is here

I loaded my init-theme.el file here

And supposedly that should make the darkclean theme available.

But when I type M-x load-theme TAB the darkclean theme is not listed.

How can I register it for Emacs 24?

like image 303
Terrence Brannon Avatar asked Mar 23 '12 14:03

Terrence Brannon


People also ask

How do I install a custom theme in Emacs?

You can enable a specific Custom theme in the current Emacs session by typing M-x load-theme . This prompts for a theme name, loads the theme from the theme file, and enables it. If a theme file has been loaded before, you can enable the theme without loading its file by typing M-x enable-theme .

How do I get dark Mode in Emacs?

Alt + x load-theme , then press Tab to show a list of available themes. Alternatively, Alt + x customize-themes to set a color theme. M-x customize-themes. Click to see the change immediately.


2 Answers

If you install themes via elpa / package.el you'll notice that you need to add each theme folder into your custom-theme-load-path - this is a bit of a pain to do manually, especially when you take into account upgrades will create a new folder, e.g. 0.1.0 -> 0.1.2 will be a new folder inside your elpa folder.

Assuming you've installed your elpa packages into ~/.emacs.d/elpa/ add this script to your ~/.emacs.d/init.el

(require 'dash)
(require 's)

(-each
   (-map
      (lambda (item)
      (format "~/.emacs.d/elpa/%s" item))
   (-filter
      (lambda (item) (s-contains? "theme" item))
      (directory-files "~/.emacs.d/elpa/")))
   (lambda (item)
      (add-to-list 'custom-theme-load-path item)))

You'll need dash.el and s.el (available from elpa.)

like image 51
ocodo Avatar answered Sep 27 '22 23:09

ocodo


init-themes has commented out the load path.

I have this (add-to-list 'custom-theme-load-path "~/.emacs.d/themes") and i think it found all my themes with M-x load-theme, enter then hit tab to see all the themes.

there was no search in the github for your repo, so i couldn't grep to see if you are doing it elsewhere. Also is your darkclean compatible with a 24 theme?

Edit: 1

actually i thought of another debug technique to rule out it being darkclean vs setup. put into your directory the solarized theme and if you don't see it in your load-theme you know it's you and not a theme, as solarized worked for me this way on emacs 24.

I don't enjoy it, and prefer wombat actually.

like image 39
pjammer Avatar answered Sep 28 '22 01:09

pjammer