1
votes

When I open some .tex files with emacs, I get the following message:

File mode specification error: (error "Autoloading failed to define function latex-mode")

and emacs is not is latex mode. The latex part of my init.el file is the following:

(require 'tex)
(setq TeX-PDF-mode 1)
(custom-set-variables
 '(TeX-view-program-list (quote (("Evince" "evince --page-index=%(outpage) %o")))))
(custom-set-faces)

I checked the installation of the auctex package already.

What is wrong?

1

1 Answers

2
votes

Auctex does not provide tex, it provides auctex. Delete the (require 'tex) line, as it's already loaded inside auctex.

My auctex configuration for comparison:

;; AUCTeX
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)

(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)

(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)

(setq TeX-PDF-mode t)

;; Automatically activate folding mode in auctex, use C-c C-o C-b to fold.
(add-hook 'TeX-mode-hook
      (lambda () (TeX-fold-mode 1))); Automatically activate TeX-fold-mode.

;; Load german inspell if babel is german
;(add-hook 'TeX-language-de-hook
;      (lambda () (ispell-change-dictionary "german")))

(provide 'my_auctex)

which I load from my master config file with (require 'my_auctex).