Recently, I found a website providing many color themes for Emacs, so I decided to install one. However, I was confused by some instructions from web or other forums and I couldn't manage to install anything.

So I come here to ask for help, hope someone could help me install a color theme for Emacs!

My OS is Ubuntu.

PS: I have downloaded one color theme, extract it to a folder called elisp, and wrote the following command in the .emacs file

(add-to-list 'load-path "~/elisp/black-theme-master")
(require 'blackboard-theme)

when I open Emacs, it gives me an error warning.

Warning (initialization): An error occurred while loading `/home/shieh/.emacs':

File error: Cannot open load file, blackboard-theme

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with

the theme I got is here: Blackborad theme

  • Could you edit your answer to explain what you have tried so far, please? – Dan Dec 17 '14 at 12:57
  • 1
    Please also provide the link to where you got the color theme. A google search turned up this version of blackboard-theme, which suggests you need to use (load-theme 'blackboard t) in your init file. – Dan Dec 17 '14 at 13:21
  • You mistyped "blackboard" as "blackborad". I suspect that there are other typos. Once you have found and fixed them, things will likely work as expected. As far as I know "Cannot open load file, SOMEFILE" always means "SOMEFILE isn't on the load-path". You say you did put it on the load-path, but that likely isn't true, probably because of a typo. – tarsius Dec 17 '14 at 22:05

It's more efficient to have a directory i.e., ~/.emacs.d/site-lisp or ~/elisp, act as a default directory for your byte-compiled/source files, and have emacs add that directory (and its sub-directories) to its load path as such:

(let ((default-directory (expand-file-name "~/.emacs.d/site-lisp/")))
  (setq load-path
         (let ((load-path (copy-sequence load-path)))
            (copy-sequence (normal-top-level-add-to-load-path '(".")))

Then adding your theme is as simple as

git clone https://github.com/don9z/blackboard-theme.git ~/.emacs.d/site-lisp/blackboard-theme

And in your ~/.emacs.d/init.el

(require 'blackboard-theme)


I would recommend using melpa, where applicable, however.

  • 4
    Or just (let ((default-directory "~/.emacs.d/site-lisp/")) (normal-top-level-add-subdirs-to-load-path)), as it does it's job by side-effect. Also (append (copy-sequence a-list) ... last-list) doesn't make sense, because append already copies all lists but the last. To add the top-level just add add-to-list. – tarsius Dec 17 '14 at 21:46
  • This solution looks far too complicated to me. It is also too generic. It doesn't really address "how to install a color theme" but rather "how to alter load-path to make require more convenient". – paprika Dec 29 '14 at 0:38

If you have the theme file stored at ~/elisp/black-theme-maste/blackboard-theme.el use the following:

(add-to-list 'custom-theme-load-path "~/elisp/black-theme-maste/")
(load-theme 'blackboard)

Edit: You have to omit the "-theme" in load-theme part; however, it is required in the filename for emacs to recognize it as a theme.

  • I still get the same error. Can you provide me another way to install a Emacs color theme(Need specific instructions!) – chinashieh Dec 17 '14 at 14:29
  • The OP stated in the question that he/she extracted the file to the elisp directory -- perhaps that's the problem with trying to use a sub-directory called black-theme-maste (especially when that sub-directory may not exist)? – lawlist Dec 17 '14 at 16:47
  • @chinashieh Check for typos. Are your really adding an existing directory which does contain the theme to the load-path? E.g. why "maste" did you mean "master"? – tarsius Dec 17 '14 at 19:13
  • Entries of load-path and similar should not and with a slash. It doesn't really hurt if they do, but you might get duplicated, but non-equal entries. – tarsius Dec 17 '14 at 21:50

Your Answer

