0

I recently started using MAC OS X Mavericks and I installed Emacs Version 24.3 (9.0) for MAC. Previously I used Emacs 23 on my Ubuntu laptop and everything worked great.

I was trying to reset my .emacs init file on the MAC OS X (using the one I have created time after time on the Ubuntu laptop), but I came across some problems due some modes I used to use:

When I start emacs I get the following error:

File error: Cannot open load file, color-theme

I know this usually happens when Emacs can't find the file but everything worked on Ubuntu, here is the Lisp:

(add-to-list 'load-path "/usr/share/emacs/site-lisp/emacs-goodies-el/color-theme.el")
(require 'color-theme)
(eval-after-load "color-theme" 
  '(progn
     (color-theme-initialize)
         (color-theme-dark-tonio)))  

Actually, the file /usr/share/emacs/site-lisp/emacs-goodies-el/color-theme.el exists on my MAC, but I get this error, does someone came across a similar problem and resolved it? What should I do?

Thanks for the attention

tonix
  • 6,671
  • 13
  • 75
  • 136
  • Since you `require` color-theme just before, you don't need the `eval-after-load` wrapper which is just there to delay execution of the last two lines to after color-theme is loaded. – Stefan Jul 08 '14 at 14:33

2 Answers2

3

Your load path shouldn't point directly to the file itself. Try changing the first line to:

(add-to-list 'load-path "/usr/share/emacs/site-lisp/emacs-goodies-el")

You might also investigate using the new package functionality:

(require 'package)
(add-to-list 'package-archives
    '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(unless (package-installed-p 'color-theme)
    (package-refresh-contents) (package-install 'color-theme))

Which will make it easier to copy your .emacs to a new machine and have it work without the effort of moving all your elisp over.

neal
  • 557
  • 2
  • 9
2

load-path should contain the directory in which the file is found. I.e. use (add-to-list 'load-path "/usr/share/emacs/site-lisp/emacs-goodies-el/")

Stefan
  • 27,908
  • 4
  • 53
  • 82
  • worked like a charm, thank you! Thou' I keep don't understand why it worked on Ubuntu with Emacs 23.4... – tonix Jul 08 '14 at 15:01
  • Probably because something else added that directory to `load-path` for you. – Stefan Jul 08 '14 at 15:34