Wilfred / ag.el

An Emacs frontend to The Silver Searcher
http://agel.readthedocs.org/en/latest/
524 stars 61 forks source link

Don't fail if we have no evil #84

Closed chillum closed 9 years ago

chillum commented 9 years ago

ag.el currently fails compiling if there is no evil-core package.

My patch allows ag.el to skip the evil stuff if (require 'evil-core) fails at compile time.

I admit, omitting the evil stuff if we have no evil at compile-time is not very graceful, but it's surely nicer then failing the compilation if user has no evil.

chillum commented 9 years ago

I've edited my patch to come with a better solution.

We should always add EVIL stuff, but should not fail to compile if we have no evil.

In fact, we don't want that compile-time require at all and everything is OK.

Wilfred commented 9 years ago

Note that this patch is pretty much reverting a9f30b76a33b4c10af0ccc1cd70c5d61697988b4, which was introduced to fix #81 (without that line, ag.el doesn't work when Emacs is started afresh due to the macro not being expanded). See the discussion in #82 -- I think this is impossible to fix in ag.el itself, and we need to push the fix upstream.

chillum commented 9 years ago

Uhm, that seems weird, but I got it.

Take a look at this version, maybe, everyone will be happy with it:

  1. we still call evil-core at compile-time (although, I can't reproduce the expanding of eval-after-load without feature evil myself)
  2. we don't fail, if evil-core does not exist
Wilfred commented 9 years ago

I can't reproduce the expanding of eval-after-load without feature evil myself

Sorry, I didn't express that very clearly. The macro that causes problems is evil-add-hjkl-bindings. If evil-add-hjkl-bindings is not defined when the file is byte-compiled, Emacs assumes it's a function rather than expanding it. As a result, when the user loads evil, they get an error Invalid function: evil-add-hjkl-bindings (this was issue #81).

I'm going to merge this, because it's definitely an improvement. Once evil upstream accepts our patch: https://gitorious.org/evil/evil/merge_requests/75 I think we should remove all references to evil in ag.el.