LinuxHappy's Weblog

Failures and Successes of Linux-based Development

Posts Tagged ‘emacs’

Ruby syntax highlighting in emacs

Posted by linuxhappy on February 2, 2008

Found this awesome link for getting ruby syntax highlighting in emacs and seems to work swell in for Ubuntu 7.10.

Emacs Ruby Foo

wget http://svn.ruby-lang.org/repos/ruby/tags/v1_8_5_53/misc/inf-ruby.el
wget http://svn.ruby-lang.org/repos/ruby/tags/v1_8_5_53/misc/ruby-mode.el
sudo cp inf-ruby.el /usr/local/share/emacs/22.1/site-lisp/.
sudo cp ruby-mode.el /usr/local/share/emacs/22.1/site-lisp/.

then… copy and paste this into your ~/.emacs file

;loads ruby mode when a .rb file is opened.
(autoload 'ruby-mode "ruby-mode" "Major mode for editing ruby scripts." t)
(setq auto-mode-alist  (cons '(".rb$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist  (cons '(".rhtml$" . html-mode) auto-mode-alist))

Now you’re on your way to open your .rb files (assuming font-lock-mode is on) with syntax highlighting!
(Alt-x font-lock-mode)

Posted in Ruby, Rails, or Ruby on Rails | Tagged: , | 5 Comments »