11

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?

Grzegorz Rożniecki
  • 27,415
  • 11
  • 90
  • 112
Terrence Brannon
  • 4,760
  • 7
  • 42
  • 61

4 Answers4

11

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.)

Nicolas Dudebout
  • 9,172
  • 2
  • 34
  • 43
ocodo
  • 29,401
  • 18
  • 105
  • 117
  • FYI using [el-get](http://www.emacswiki.org/emacs/el-get) doesn't require manually updating your load-paths. I've verified mine got updated automatically with `C-h v RET custom-theme-load-path`. – Tim S. Aug 07 '14 at 02:57
  • @TimS. many themes will add themselves to the `custom-theme-load-path` automatically when installed (most newer/well maintained ones will at least.). The script above just adds those that don't. There's nothing in the el-get source itself which appears to do anything with the `custom-theme-load-path`, go ahead and grep it. – ocodo Aug 09 '14 at 08:29
  • yeah, what I meant to say was that many themes installed will auto-update the path, not el-get itself... my mistake. Thanks. – Tim S. Aug 10 '14 at 20:56
7

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.

pjammer
  • 9,489
  • 5
  • 46
  • 56
4

I m new to emacs and wanted to add some custom themes and create my own as well.

first add this

(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")

then add any new theme to that folder. This first did not work and when i used load-theme the themes in ~/.emacs.d/thems where not loaded.

the documentation says:

Each theme file is named THEME-theme.el, where THEME is the theme name.

so renaming darklean.el to darkclean-theme.el did the trick

jassinm
  • 7,323
  • 3
  • 33
  • 42
  • Ahh did the trick! Thanks, was pulling my hair out why my theme couldn't be found until I saw you just had to add -theme to the end. Thanks a million! – FrostedCookies Feb 28 '21 at 19:03
0

I think you need to set custom-theme-directory and then include the sha256 hash in custom-safe-themes to remove the confirmation prompt everytime you load it. To insert the sha256 hash, you can use the customize interface, as then it is calculated for you. To enable the theme, you will have to include it in custom-enabled-themes.

Below is an example from my setup:

(custom-set-variables
 ;; ...
 '(custom-enabled-themes (quote (dark-emacs)))
 '(custom-safe-themes (quote ("<SHA256 hash goes here>" default)))
 '(custom-theme-directory "~/.emacs.d/themes/")
)

To see my actual setup, take a look at the following links:

suvayu
  • 4,271
  • 2
  • 29
  • 35