Groovy-Emacs-Modes / groovy-emacs-modes

A groovy major mode, grails minor mode, and a groovy inferior mode.
84 stars 39 forks source link

Require groovy-mode with value added to hook results in error: Symbol's value as variable is void: inf-groovy-keys #8

Closed m0smith closed 9 years ago

m0smith commented 9 years ago

It looks like when the hook is evaluated, it is calling the first element in the hook with the second. Very weird.

Groovy mode: .emacs.d/elpa/groovy-mode-20141209.1133/

groovy-mode-hook is a variable defined in `groovy-mode.el'.
Its value is (malabar-groovy-mode inf-groovy-keys)
Original value was nil

The backtrace


  (malabar-groovy-mode inf-groovy-keys)
  (lambda nil (malabar-groovy-mode inf-groovy-keys))()
  funcall((lambda nil (malabar-groovy-mode inf-groovy-keys)))
  (if (not (equal file (quote "c:/Users/lpmsmith/.emacs.d/elpa/groovy-mode-20141209.1133/groovy-mode.el"))) nil (remove-hook (quote after-load-functions) (quote eval-after-load-helper)) (funcall (quote (lambda nil (malabar-groovy-mode inf-groovy-keys)))))
  eval-after-load-helper("c:/Users/lpmsmith/.emacs.d/elpa/groovy-mode-20141209.1133/groovy-mode.el")
  run-hook-with-args(eval-after-load-helper "c:/Users/lpmsmith/.emacs.d/elpa/groovy-mode-20141209.1133/groovy-mode.el")
  do-after-load-evaluation("c:/Users/lpmsmith/.emacs.d/elpa/groovy-mode-20141209.1133/groovy-mode.el")
  load-with-code-conversion("c:/Users/lpmsmith/.emacs.d/elpa/groovy-mode-20141209.1133/groovy-mode.el" "c:/Users/lpmsmith/.emacs.d/elpa/groovy-mode-20141209.1133/groovy-mode.el" nil t)
  require(groovy-mode)
  eval((require (quote groovy-mode)) nil)
  eval-expression((require (quote groovy-mode)) nil)
  call-interactively(eval-expression nil nil)
russel commented 9 years ago

I just tried to reproduce this so as to work on it. I started up an emacs editing a groovy file, which takes me to groovy-mode. I then tried to execute malabar-groovy-mode to switch and see if I can get the above, but I get: Cannot open load file: not a directory, semantic/db-javap.

m0smith commented 9 years ago

Ok. I will try and get a simpler example.

m0smith commented 9 years ago

I found the problem, it was with the code adding to the hook.

russel commented 9 years ago

I'm pleased the problem was found. There were hints that the problem was in the definition of the hook, a lack of quoting. Was this the case?

m0smith commented 9 years ago

Exactly.

pajatopmr commented 9 years ago

@m0smith Could you elaborate on what your issue was. I've encountered a similar issue and am scratching my head trying to understand what I am doing wrong. I have a hunch that if I see what you did it will enlighten me.

m0smith commented 9 years ago

I think this is the commit: https://github.com/m0smith/malabar-mode/commit/ae86a7cbc7fa5476fd124336cda5dff9bdcc2aaa

Basically, I was not passing a lambda to eval-after-load. Instead I was calling the function and adding the result, which was nil

pajatopmr commented 9 years ago

Thanks for the quick response. Having the commit to look at helps enormously. While my problem looks a little different, at least I have something to chew on now. Much appreciated.

hamtie commented 9 years ago

I've been banging my head over this error:

symbol's value as variable is void: inf-groovy-keys

I don't know lisp that well or really know what's wrong but I think the above commit fixes it. At least, my error went away after I changed it there and in the pkg file from melpa. (Grepped for add-hook and added lambdas basically.)