1

After upgrading my OS (Ubuntu, from 18.04 to 19.04), my favorite text editor was automatically upgraded from Emacs 25 to Emacs 26. I then encountered a familiar error message at start-up:

File is missing: Cannot open load file, No such file or directory, color-theme

The relevant portion of my configuration file, .emacs, is the following:

(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(add-to-list 'load-path "/path/to/color-theme.el/file")
(require 'color-theme)
(eval-after-load "color-theme"
    '(progn
     (color-theme-initialize)
     (color-theme-subtle-hacker)))

This works fine with emacs 25 or earlier versions, under Ubuntu 18.04. Naturally, the relevant file, color-theme-subtle-hacker.el is located in ~/.emacs.d/themes/.

I imagine that there are at least two possible solutions to this problem:

(i) There is a way to "tell" Emacs 26 where is the relevant color-theme package. The problem could, in fact, be due to the OS upgrade.

(ii) I could also force Ubuntu 19.04 to use Emacs 25. However, I would have to install it manually, since every attempt at installing Emacs currently leads to version 26.

6
  • The error message says that Emacs can't find the color-theme "package", not that the color theme package can't find the theme you chose. I.e. it probably errors at (require 'color-theme).
    – Stefan
    Jan 18, 2020 at 13:23
  • Thanks. Yes, this was indeed what I had understood. The problem is to do with finding the package, 'color-theme'.
    – Nicomachus
    Jan 18, 2020 at 13:28
  • 1
    Put color-theme.el in your load-path, in your init file, before trying to require it. (If you haven't downloaded color-theme.el then that's of course the first step.)
    – Drew
    Jan 18, 2020 at 16:01
  • 1
    The load-path is a list of directories, not absolute path(s) to file(s). The question states that the O.P. is adding an absolute file path of the color-theme file to the load-path, instead of merely ensuring that the directory containing the file is added to the load-path.
    – lawlist
    Jan 18, 2020 at 17:48
  • In addition, custom-theme-load-path is not used for the color-theme package.
    – InHarmsWay
    Jan 21, 2020 at 12:02

2 Answers 2

2

I report my solution, as I found the other answer quite misleading: since version 22.1 Emacs has built-in support for themes, and color-theme is obsolete, see the package page on MELPA.

One can install and use color-theme-modern instead (on MELPA) or if you have Emacs 24 or above, just download the theme file and load it directly, as shown here.

0

Thanks for your help. I have found one solution to this problem. It was sufficient to download the color-theme.el and the color-theme-library.el and to copy them in ~/.emacs.d/themes/. Together with the simplified code in one's .emacs file eliminate all errors at start-up.

(add-to-list 'load-path "~/.emacs.d/themes/")
(require 'color-theme)
(eval-after-load "color-theme"
    '(progn
     (color-theme-initialize)
     (color-theme-subtle-hacker)))

Thanks to @Drew, @lawlist, @InHarmsWay and @Stefan for your help. It seems that the files from the emacs-goodies package weren't accessible by my .emacs file, after upgrading to the latest Ubuntu distribution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.