【问题标题】:What is the correct syntax for .emacs file in emacs 23?emacs 23 中 .emacs 文件的正确语法是什么?
【发布时间】:2013-08-27 13:06:06
【问题描述】:

我正在尝试根据 http://david.rothlis.net/emacs/customize_colors.html 在 emacs 23 中获得日晒颜色主题。我已将所有文件夹和文件放在 ~/.emacs.d 中。然后我补充说:

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

到我的 .emacs 文件。然而,这给了我以下错误:

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

Invalid read syntax: )

调试就是这样:

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

我已经在这方面工作了很长时间,但我似乎无法通过自己、http://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Syntax.html#Init-Syntax、SO 或其他地方找到正确的方法。我对 Linux 很陌生,尽管我认为这不是造成这种情况的原因。任何帮助是极大的赞赏。谢谢。

PS 这就是我的整个 .emacs 的样子:

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

【问题讨论】:

    标签: syntax-error init emacs23


    【解决方案1】:

    你为什么要引用整件事?

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

    你不想要最后一个'

    您只需要引用 load-path 以便将其传递给 add-to-list 而不会 out 被评估。

    试试这个:

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

    更多信息请见:
    add-to-list
    load-path

    除了以上内容,您可能还需要将以下内容添加到您的 init.el 把它放在`(需要'color-theme)'之后的某个地方

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

    以上代码来自color-theme网站,我的口碑不够高 要发布更多链接,否则我会包含它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-07
      相关资源
      最近更新 更多