Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs auto-complete error: Symbol's value as variable is void: ac-modes [duplicate]

I'm trying to install the emacs latex auto-complete package (http://code.google.com/p/ac-math/). I put ac-math.el into my ~/elisp load-path directory then put the following into my .emacs file:

;; Adds elisp to load-path
(add-to-list 'load-path "~/elisp")

;; Loads latex auto-complete
(require 'ac-math)
(add-to-list 'ac-modes 'latex-mode)
(defun ac-latex-mode-setup ()
  (setq ac-sources
        (append '(ac-source-math-latex ac-source-latex-commands  ac-source-math-unicode)
                ac-sources))
  )
(add-hook 'LaTeX-mode-hook 'ac-latex-mode-setup)

But when I load emacs I get this error:

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

Symbol's value as variable is void: ac-modes

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.

Thanks in advance

like image 356
Eddy Avatar asked Aug 20 '11 12:08

Eddy


2 Answers

Add (require 'auto-complete) at the top. Or, better yet, convince the ac-math package maintainer to add it there.

like image 195
tripleee Avatar answered Oct 08 '22 19:10

tripleee


I had to install the auto-complete package first. I had mixed up the math auto-complete package with the actual auto-complete package.

So first you go here to install the auto-complete package: http://cx4a.org/software/auto-complete/

Then you go here for the math auto-complete add-on: http://code.google.com/p/ac-math/

The problem was that I was trying to install the math add-on without first installing the auto-complete package

like image 3
Eddy Avatar answered Oct 08 '22 19:10

Eddy