4

I just installed evil-mode from melpa and when the installation finishes I get the message ad-handle-definition: 'evil-mode' got redefined.

ad-handle-definition: 'evil-mode' got redefined

I can then enable evil-mode but get the same warning. But the next time I open emacs and try to enable evil-mode I get this error: Autoloading failed to define function evil-mode

Autoloading failed to define function evil-mode

Searching around leads me to understand basically that somewhere along the line evil-mode gets redefined or lost, but I don't know where to start in debugging this.

I've tested:

  1. Removing evil through the package manager and reinstalling
  2. Removing the evil-<date> folder from the elpa packages and reinstalling
  3. Installing the package from marmalade. I don't get the ad-handle-definition error then, but I still get Autoloading failed to define function evil-mode

I'm using emacs version 24.4.1 on OSX.

It kinda feels as if emacs is trying to tell me something behaving like this. ^^

  • This looks like it should be a bug report. Submit here. – tmalsburg Dec 26 '14 at 15:56
  • @tmalsburg ok, I've created an issue there. Thanks. :) – gaqzi Dec 26 '14 at 16:13
  • I'm experiencing the same problem for a while now (Emacs 25.0.50.10, Ubuntu 14.04). So thank you for reporting it. – tmalsburg Dec 26 '14 at 17:52
  • I am experiencing the same issue, with version 20150408.1417, available in elp and melpa. The above ticket has been closed as "wontfix", but things are still broken. – lbolla Apr 11 '15 at 16:44
  • ad-handle-definition: 'evil-mode' got redefined isn't an error. This happens when some advice for evil-mode has been evaluated in advance of evil-mode itself being defined or loaded. When the function is defined, the existing advice immediately redefines it, and Emacs provides notice that this has happened. If the advice is instead evaluated afterwards, this notice will not occur. – phils Apr 14 '16 at 5:15
2

To disable the initial warnings, I use:

(set 'ad-redefinition-action 'accept)

I haven't encountered your other errors, but they might be offshoots of the above. I haven't either investigated the side-effects of setting the above variable globally, I'll update this answer if I find any issues.

0

Throwing a (require 'evil) in a function called by the hook after-init-hook fixes it for me:

(defun after-all-loads () (require 'evil))

(add-hook 'after-init-hook 'after-all-loads)
0

I have a few different files that I load in the init.el, one of these files loading the evil-mode related definitions. Adding the statements according to below in the evil-mode definition file solved the problem for me.

(require 'evil)
;; all the definitions goes here
(add-hook 'evil-after-load-hook (lambda () ...)) ; config

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.