What is the correct syntax for .emacs file in emacs 23?

1.1k views Asked by At

I am trying to get solarized color theme in emacs 23 as per http://david.rothlis.net/emacs/customize_colors.html . I have put all folders and files in ~/.emacs.d . Then I added:

(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0"')
(add-to-list 'load-path "~/.emacs.d/emacs-color-theme-solarized-master"')
(require 'color-theme)
(require 'color-theme-solarized)

To my .emacs file. This however gives me the following error:

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

Invalid read syntax: )

With debugging thats:

Debugger entered--Lisp error: (invalid-read-syntax ")")
eval-buffer(#<buffer  *load*> nil "/home/brain/.emacs" nil t)  ; Reading at buffer position 80
load-with-code-conversion("/home/brain/.emacs" "/home/brain/.emacs" t t)
load("~/.emacs" t t)
#[nil "\205\264

I have been at this for a long time now and I just cant seem to find the right way to do this either by myself, on http://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Syntax.html#Init-Syntax, on SO or elsewhere. I am quite new to Linux, though I dont think that is the cause of this. Any help is greatly appreciated. Thanks.

PS this is how my whole .emacs looks:

(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(custom-set-faces
 ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 83 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0"')
(add-to-list 'load-path "~/.emacs.d/emacs-color-theme-solarized-master"')
(require 'color-theme)
(require 'color-theme-solarized)
1

There are 1 answers

0
Cory Koch On BEST ANSWER

Why are you quoting the whole thing?

(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0"')
(add-to-list'load-path "~/.emacs.d/emacs-color-theme-solarized-master"')

You do not want the last '.

You are only suppose to quote load-path so that it is passed to the add-to-list with out being evaluated.

Try using this:

(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0")
(add-to-list 'load-path "~/.emacs.d/emacs-color-theme-solarized-master")

For more information See:
add-to-list
load-path

In addition to above you may want to add the following to your init.el put it somewhere after ` (require 'color-theme) '

(eval-after-load "color-theme"
  '(progn
     (color-theme-initialize)
     ;; Load solarized at startup
     (color-theme-solarized)))

The code above is from the color-theme site, my reputation is not high enough to post more that one link else I would have include it.