I am using GNU Emacs 24.4.1 (x86_64-apple-darwin14.0.0) I installed auto-complete from Melpa, and have the following line in init.el:
(global-auto-complete-mode 1)
When I open up emacs, it fires up an warning:
Warning (initialization): An error occurred while loading `/Users/lita/.emacs.d/init.elc':
Symbol's function definition is void: global-auto-complete-mode
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.
And the auto-complete-mode wasn't start. After I changed the line in init.el into:
(eval-after-load 'auto-complete (global-auto-complete-mode 1))
It still came up with the same warning. But if I `eval-buffer, it turns on the auto-complete.
What's the problem with that??
In your init file, you should call
(package-initialize)
before referring to packages.In addition, you have a typo in your
eval-after-load
statement. You need to quote the form, otherwise it's evaluated immediately, which is the reason why you get the warning. In other words:Alternatively, you can use the new macro
with-eval-after-load
.