配置emacs for latex - void-variable LaTeX-mode-hook

Ber*_*ach 5 emacs configuration latex auctex

这个pdf文档之后,我将以下内容添加到我的~/.emacs文件中:

(load "auctex.el" nil t t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-PDF-mode t) ;; .pdf statt .dvi per default:
;;Zeilenumbruch
;;(add-hook ’LaTeX-mode-hook ’turn-on-auto-fill)
;;Syntax Higlight
(add-hook ’LaTeX-mode-hook ’turn-on-font-lock)
;; Mathe Modus
(add-hook ’LaTeX-mode-hook ’LaTeX-math-mode)
;; Reftex einflechten und laden
(setq reftex-plug-into-AUCTeX t)
(add-hook ’LaTeX-mode-hook ’turn-on-reftex)
;; Satzende ". " statt ". ". " fuer M-k: loeschen bis Satzende usw.
;;(setq sentence-end "[.?!][]\"’)}]*\\($\\| \\| \\)[
;;]*") ;; Da ist ein "Newline in der Zeile!"
;;(setq sentence-end-double-space nil)
;;direkte Rechtschreib Korrektur:
;;(add-hook ’LaTeX-mode-hook ’flyspell-mode)
;; Nur benutzen falls Auctex > 11.81 mit preview-latex:
(load "preview-latex.el" nil t t)
;; aspell ist besser als ispell.
;; Zeile kommentieren, falls nicht installiert:
(setq-default ispell-program-name "aspell")
;; Deutsche Rechtschreibung falls \usepackage{ngerman}
;; oder german benutzt wird
(add-hook ’TeX-language-de-hook
(function (lambda () (ispell-change-dictionary "german8"))))
Run Code Online (Sandbox Code Playgroud)

不幸的是,emacs现在无法启动,而是出现了错误

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

Symbol's value as variable is void: ’LaTeX-mode-hook

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.
Run Code Online (Sandbox Code Playgroud)

--debug-init它开始时提供以下信息

Debugger entered--Lisp error: (void-variable ’LaTeX-mode-hook)
  (add-hook ’LaTeX-mode-hook ’turn-on-font-lock)
  eval-buffer(#<buffer  *load*> nil "/home/../.emacs" nil t)  ; Reading at buffer position 812
  load-with-code-conversion("/home/../.emacs" "/home/../.emacs" t t)
  load("~/.emacs" t t)
...
Run Code Online (Sandbox Code Playgroud)

我尝试使用了latex-mode-hook.我搜索了一个解决方案,但我似乎是唯一一个有这个问题的人.

我正在使用Ubuntu 12.04和最新的Emacs和Auctex.如果需要,我会发布版本信息,但我认为必须在配置中添加某些内容,或者必须安装任何软件包.

如何让emacs使用该配置?

Tho*_*mas 9

你使用错误的单引号字符吗?它似乎是某种落后的引用,而不是简单的单引号.尝试

'LaTeX-mode-hook
Run Code Online (Sandbox Code Playgroud)

代替

’LaTeX-mode-hook
Run Code Online (Sandbox Code Playgroud)

(同样适用于该角色的所有其他事件).