RubyMode

RubyMode provides font-locking, indentation support, and navigation for Ruby code.

It’s included in Emacs 23 and is also available via ELPA. However, those copies have no guarantees of backwards-compatibility, so if you’re having trouble with it on an older Emacs version or XEmacs, you can use the copy that’s included with Ruby, which attempts to be highly compatible. You can get it from Ruby’s trunk like this:

  svn co http://svn.ruby-lang.org/repos/ruby/trunk/misc ruby-mode

Web frontend to that repository: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/misc/

To enable ruby-mode for most all ruby files, add this to your initialization file

  (add-to-list 'auto-mode-alist
               '("\\.\\(?:cap\\|gemspec\\|irbrc\\|gemrc\\|rake\\|rb\\|ru\\|thor\\)\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist
               '("\\(?:Brewfile\\|Capfile\\|Gemfile\\(?:\\.[a-zA-Z0-9._-]+\\)?\\|[rR]akefile\\)\\'" . ruby-mode))

See also RubyOnRails, EnhancedRubyMode, RakefileMode, RSpecMode


RubyLanguage ProgrammingModes