Groovy-Emacs-Modes / groovy-emacs-modes

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

File mode specification error: (void-function groovy-mode) #47

Closed root42 closed 7 years ago

root42 commented 7 years ago

I just upgraded to groovy-mode 20170503.148 on my GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911)). Now I am getting the error in the subject line. Using MELPA to install my packages.

russel commented 7 years ago

@root42 Thanks for sending in a new issue. I'll dig out my ancient MBP and see if I can reproduce this so as to investigate.

root42 commented 7 years ago

@russel there was another guy in the other issue you closed today that who had the same problem in Spacemacs. I think this might be a general problem when upgrading from an older groovy-mode via MELPA.

chooie commented 7 years ago

Doing a fresh install worked until I next restarted Emacs. I was using 'use-package' and managed to resolve my issue by not setting the ':defer' flag.

e.g.

(use-package groovy-mode
    :ensure t
    :init
    (setq groovy-indent-offset 2)
    :config (message "Loaded groovy mode"))

;; automodes
(add-to-list 'auto-mode-alist '("Jenkinsfile$" . groovy-mode))
glennehrlich commented 7 years ago

I ran into this as well today, on Mac and Linux, emacs 26.0.50, groovy-mode-20170516.1155 from melpa.

I had this in my init:

(use-package groovy-mode
  :defer t)

I can get it to work by doing this:

(use-package groovy-mode
  :defer t
  :mode ("\\.g\\(?:ant\\|roovy\\|radle\\)\\'\\|Jenkinsfile\\'" . groovy-mode))

Looking at the automatically generated groovy-mode-autoloads.el, there's no autoload for the function groovy-mode which explains the void function error. Looking in groovy-mode.el, there's no autoload cookie for groovy-mode. So I think if you put the autoload cookie before the definition for groovy-mode, then deferred loads from use-package should work ok.

russel commented 7 years ago

This may not have been an OSX problem, just a general problem. The groovy-mode-hook variable was not defined, nor autoloaded, nor was the mode function itself autoloaded. I have added these to code and pushed. This should appear in MELPA on the next build.

Hopefully, this fixes things so the "fixes" suggested by @glennehrlich and @chooie are not needed.

russel commented 7 years ago

I should apologise that I am not seeing these problems as I load up the Groovy modes manually so I can experiment before pushing to mainline and thence to MELPA.

glennehrlich commented 7 years ago

I’m pretty sure you’ll only see the problem if you are relying on some sort of deferred loading behavior, ala use-package. If you manually load or require it, you won’t see the problem. The mode worked fine when I loaded it manually from the package manager, then wouldn’t work when I formalized the mode in my init.el in with use-package.

On May 22, 2017, at 10:49 PM, Russel Winder notifications@github.com wrote:

I should apologise that I am not seeing these problems as I load up the Groovy modes manually so I can experiment before pushing to mainline and thence to MELPA.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Groovy-Emacs-Modes/groovy-emacs-modes/issues/47#issuecomment-303296909, or mute the thread https://github.com/notifications/unsubscribe-auth/AMIZ7I1VdSlCnqFfugBwawoJvgi3uIVYks5r8nNzgaJpZM4NcKAt.

glennehrlich commented 7 years ago

I’ll check the fix when I seen an update and I’ll update the issue with what I find. Thanks for the quick fix!

On May 22, 2017, at 10:47 PM, Russel Winder notifications@github.com wrote:

This may not have been an OSX problem, just a general problem. The groovy-mode-hook variable was not defined, nor autoloaded, nor was the mode function itself autoloaded. I have added these to code and pushed. This should appear in MELPA on the next build.

Hopefully, this fixes things so the "fixes" suggested by @glennehrlich https://github.com/glennehrlich and @chooie https://github.com/chooie are not needed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Groovy-Emacs-Modes/groovy-emacs-modes/issues/47#issuecomment-303296642, or mute the thread https://github.com/notifications/unsubscribe-auth/AMIZ7Dtx--M2Z7F4I8jR_YFNvEHPRnMZks5r8nL3gaJpZM4NcKAt.

glennehrlich commented 7 years ago

The fix works for me. Deferred loading via use-package works as expected for me.

My original use-package in init.el now works:

(use-package groovy-mode
  :defer t)

Thanks for the quick fix on this!

russel commented 7 years ago

I think we'll close this one as success, fixed. :-)