Friday, December 29, 2006

Ruby with emacs

A blog entry after a long time. Off late I have been a big fan of emacs and ruby. I like emacs for its amazing capabilities and easy to remember key strokes. Ruby is a breath of fresh air in programming language and it's quiet interesting to learn. So i decided to customize emacs to use it with ruby.

Install ruby on windows then, follow these instructions from
http://math.claremontmckenna.edu/ALee/emacs/emacs.html
to install emacs on M$-windows XP. Once your done with that add the following to the end of _emacs file

(setq config-rubyelispdir
"doc/ruby/ruby-1.8.5/misc" )
; get the installation directory
(setq config-rubydir
(substring
(shell-command-to-string
"ruby -rrbconfig -e 'puts Config::CONFIG[ \"exec_prefix\"]'") 0 -1))
; add the emacs lisp directory so emacs acan find it
(setq load-path (append
(list (expand-file-name
config-rubyelispdir config-rubydir))
load-path))
;; define autoloads
;; from inf-ruby.el
(autoload 'ruby-mode "ruby-mode"
"Mode for editing ruby source files" t)
(setq auto-mode-alist
(append '(("\\.rb$" . ruby-mode)
("[Rr]akefile" . ruby-mode))
auto-mode-alist))
(setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
interpreter-mode-alist))
(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)))

This is ripped off from
http://wiki.rubygarden.org/Ruby/page/show/InstallingEmacsExtensions

I don't know much about emac extensions, no queries about how it works. It is tested with ruby-1.8.5 on windows which comes as a one click installer.

If you face any problems, please inform me , I will try to modify the blog and update it.
More on future posts ...till then happy holidays who ever you are and where ever you are.

-/\/ishanth