Sunday, January 20, 2013

groovy with emacs on ubuntu 12.04 lts

List of steps to get groovy syntax highlighting working with emacs:

1) Get all *.el for supporting syntax (this step assumes you have a configured github account, if false, you can manually download from github)
git clone git://github.com/russel/Emacs-Groovy-Mode.git

2) Create symbolic links to new .el groovy supporting files: (assuming you performed cmd 1 and in the same folder)
ln -s `pwd`/*.el /home/yourUserName/.emacs.d/

3) Create/append to init.el
(message "Loading emacs init.el")

;;;... <body of init.el> ...

;;; pick up modules into load path
(add-to-list 'load-path "/home/<yourUserName>/.emacs.d/")

;;; 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)))

;;;... <end of body of init.el> ...

(message "Done loading emacs init.el")

(provide 'init)


3) On Ubuntu 12.04 LTS the default .emacs file is present but we need to load our newly modified /etc/<userName>/init .el

so:

rm ~/.emacs
ln -s /home/<yourUserName>/.emacs.d/init.el /home/<yourUserName>/.emacs

Optionally if you do not have your emacs configured, you will see 2 windows coming up. Make sure you enable inhibit start up screen option. That way your editor will always come up with the argument file or folder you passed.

If I missed anything, please let me know in the comments!

Happy Coding!

No comments:

Post a Comment