Emacs: recognising the shebang line

emacs

How can I configure Emacs to recognise certain she-bang lines?

it recognises the shebang line:

#!/usr/bin/env ruby

but not the shebang line of

#!/usr/bin/env ruby1.9

I figure there must be an alist somewhere with the list of scripting languages called by /usr/bin/env and the mode, but I can't find it.

Best Answer

This is controlled by interpreter-mode-alist. In my Emacs (23.2.1 on Debian), there's an entry for ruby1.9 out of the box. I guess you have an older version; you can add this to your .emacs:

(add-to-list 'interpreter-mode-alist
             '("ruby1.9" . ruby-mode))