Emacs remains the "one true editor" (apart from Vim of course, which is the other "one true editor"). Many people prefer using editors rather than fighting with IDEs. Editors need support for specific languages, hence the need for a Groovy mode for Emacs. Emacs Plugin is an old page kept for historical purposes outlining that there have been multiple goes at creating a Groovy mode for Emacs – each with their good bits and bad bits. Current development effort (thanks to Jim Morris) focuses on evolving the Emacs mode based on the Java mode of CC Mode initially started by Russel Winder, coupled with the inferior mode by Stuart Clayman.
A release was made on 2010-11-13 (but there was a fault with the tarball that was corrected 2011-06-29, hence the date on the tarball), but it is recommended that people track the mainline rather than use releases.
Getting and Installing Groovy Mode
Using the Current Release by Download
For those who want to download and install the current release tarball, one is available at Groovy Emacs Mode project page at Launchpad. There is a big green button which points to the current release download file. There is no link to the current release tarball from this page so as to avoid pointing people at an old or out of date release. The summary instructions for install are:
- Download the tarball from the Groovy Emacs Mode page on Launchpad.
- Extract the content of the downloaded tarball to your ~/.emacs.d file (for Linux, Unix and Mac OS X), whatever the equivalent is for Windows.
- Update your ~/.emacs.d/init.el or ~/.emacs file as needed to set up the appropriate autoload configuration. See "Setting Up Emacs" below.
- Restart Emacs if it is already running.
Using a Git Repository
For developers, or the more adventurous users who want to work with continuous update, then take a branch of the mainline somewhere on your filestore:
- git clone git://github.com/russel/Emacs-Groovy-Mode.git Emacs-Groovy-Mode
This creates a Git repository in the subdirectory Groovy-Emacs-Mode of the current directory. You can update to the latest version by:
- cd Emacs-Groovy-Mode
- git pull
On systems other than Windows you can use symbolic links to put these files in the right place for Emacs to find them. So assuming that you put the Groovy mode branch in ~/groovy-emacs-mode and your emacs directory is ~/.emacs.d then:
- cd ~/.emacs.d
- ln -s ../Emacs-Groovy-Mode/*.el .
this should set up all the symbolic links needed.
(Someone needs to write what to do on Windows.)
Setting Up Emacs
Emacs needs to be told when to use Groovy mode. So in your initialization file (assumed default is ~/.emacs.d/init.el) you probably want to add:
;;; turn on syntax highlighting (global-font-lock-mode 1) ;;; use groovy-mode when file ends in .groovy or has #!/bin/groovy at start (autoload 'groovy-mode "groovy-mode" "Major mode for editing Groovy code." t) (add-to-list 'auto-mode-alist '("\.groovy$" . groovy-mode)) (add-to-list 'interpreter-mode-alist '("groovy" . groovy-mode)) ;;; make Groovy mode electric by default. (add-hook 'groovy-mode-hook '(lambda () (require 'groovy-electric) (groovy-electric-mode)))
or something equivalent.
Reporting Bugs, Requests for Improvement
Please use the The Groovy Emacs Mode bug tracker for reporting all bugs and requesting new features.
This Groovy mode is developed and tested in the context of using Emacs 23. It should work with Emacs 22 but is untested. Likewise it should work with XEmacs but is untested.