SaltyCrane Blog — Notes on JavaScript and web development

Emacs ruby-mode

To install ruby-mode for emacs, I followed the directions at the digital sanitation engineering blog. I pretty much did exactly the same thing-- I don't know why I wrote my own post-- I suppose it is good just for my records.

sofeng@crayola:~/etc
$ export SITE_LISP=~/etc/.emacs.d/site-lisp
sofeng@crayola:~/etc
$ svn export http://svn.ruby-lang.org/repos/ruby/trunk/misc $SITE_LISP/ruby
A    /home/sofeng/etc/.emacs.d/site-lisp/ruby
A    /home/sofeng/etc/.emacs.d/site-lisp/ruby/rubydb2x.el
A    /home/sofeng/etc/.emacs.d/site-lisp/ruby/rubydb3x.el
A    /home/sofeng/etc/.emacs.d/site-lisp/ruby/ruby-mode.el
A    /home/sofeng/etc/.emacs.d/site-lisp/ruby/ruby-electric.el
A    /home/sofeng/etc/.emacs.d/site-lisp/ruby/inf-ruby.el
A    /home/sofeng/etc/.emacs.d/site-lisp/ruby/README
A    /home/sofeng/etc/.emacs.d/site-lisp/ruby/ruby-style.el
Exported revision 18207.
sofeng@crayola:~/etc
$ emacs -batch -f batch-byte-complile $SITE_LISP/ruby
Loading 00debian-vars...
No /etc/mailname. Reverting to default...
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Skipping dictionaries-common setup for emacs-snapshot
Loading /etc/emacs/site-start.d/50psvn.el (source)...
Symbol's function definition is void: batch-byte-complile
sofeng@crayola:~/etc
$ ll ~/etc/.emacs.d/site-lisp/ruby
total 92
-rw-r--r-- 1 sofeng sofeng   369 2008 04/10 04:36 README
-rw-r--r-- 1 sofeng sofeng 14393 2008 01/06 07:49 inf-ruby.el
-rw-r--r-- 1 sofeng sofeng  6747 2007 02/12 15:01 ruby-electric.el
-rw-r--r-- 1 sofeng sofeng 44473 2008 07/21 17:51 ruby-mode.el
-rw-r--r-- 1 sofeng sofeng  1798 2008 04/22 06:15 ruby-style.el
-rw-r--r-- 1 sofeng sofeng  4481 2007 02/12 15:01 rubydb2x.el
-rw-r--r-- 1 sofeng sofeng  4613 2007 02/12 15:01 rubydb3x.el

Then added the following to my .emacs:

(add-to-list 'load-path "~/.emacs.d/site-lisp/ruby")
(autoload 'ruby-mode "ruby-mode"
    "Mode for editing ruby source files")
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))
(autoload 'run-ruby "inf-ruby"
    "Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby"
    "Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook
    '(lambda ()
        (inf-ruby-keys)))
;; If you have Emacs 19.2x or older, use rubydb2x                              
(autoload 'rubydb "rubydb3x" "Ruby debugger" t)
;; uncomment the next line if you want syntax highlighting                     
(add-hook 'ruby-mode-hook 'turn-on-font-lock)

Comments