Configuring a Groovy Mode for Emacs

For work, I need to start learning Groovy. As I want to focus on the language and how this do work, I’ll use Emacs. This post explains how to configure an Emacs major mode for Groovy on a fresh installation of Emacs 23.2.1 on Linux.

Create ~/.emacs.d/

The ~/.emacs.d/ folder is the default folder for additional per-user Emacs-specific files.

# touch ~/.emacs

Download a Groovy Mode for Emacs

I chose to use the Groovy mode for emacs by Russel Winder. We will download the file into the modes subfolder.

# mkdir ~/.emacs.d
# cd ~/.emacs/d
# mkdir modes
# cd modes
# wget

Create ~/.emacs init file

The ~/.emacs file contain Lisp code to execute when starting up Emacs.

Configure .emacs to load the Groovy mode

Add the following lines to the ~/.emacs file

;;; add modes to the load path
(add-to-list 'load-path "~/.emacs.d/modes/")

Configure .emacs to use the Groovy mode

Let’s now add the required configuration to use Groovy mode.

;;; use groovy-mode when file ends in .groovy or has #!/bin/groovy at start
(autoload 'groovy-mode "groovy-mode" "Groovy editing mode." t)
(add-to-list 'auto-mode-alist '("\.groovy$" . groovy-mode))
(add-to-list 'interpreter-mode-alist '("groovy" . groovy-mode))


Switching SD Cards on an Android Phone

I decided to substitute the default 4GB micro SD card provided with my HTC Desire with a 16GB one. Here is a summary of how I did it. It’s extremely simple actually 🙂 I haven’t tried on any other phone but I take for granted that I shall work with other Android phones.

  1. Copy the contents of the current card to your hard drive.
  2. Copy the contents from the hard drive to the new card.
  3. Replace the current card with the new one.

As the contents of the card was the same after the substitution, I was surprised to find that WinAmp could not find back the covers of the albums in my music library. Except that, the substitution went without a hitch.

To copy the contents of the current card to the hard drive, I use a card reader. I could have plugged in the phone and copy directly from it as well.

%d bloggers like this: