From: Jim Menard Date: 2005-08-11T03:42:01+09:00 Subject: Re: Need some help setting up ruby mode francisrammeloo@hotmail.com wrote: > Hi all, > > I'm an emacs newbie but would like to use the editor for ruby coding. > > I have downloaded "ruby-mode.el" and I don't know what to do with it! > > I worked my way through the emacs built-in tutorial. I know how to use > modes, but I can't find any information about how to ADD modes to > emacs. > > I understand that this may be difficult to explain on the newsgroup. > Any link to helpful information is welcome too! Put ruby-mode.el somewhere where Emacs can find it. I have a directory where I put that kind of thing, "~/lib/elisp". In my .emacs file I added (add-to-list 'load-path "~/lib/elisp") so it can find all of my .el files. Next, add (autoload 'ruby-mode "ruby-mode" "Ruby mode" t nil) (autoload 'inf-ruby "inf-ruby" "Ruby inferior process (irb)" t nil) (setq interpreter-mode-alist (append '(("ruby" . ruby-mode)) interpreter-mode-alist)) (setq auto-mode-alist (append '(("\\.rbw?$" . ruby-mode) ("\\.rhtml$" . html-mode) ("\\.gem\\(spec\\)?$" . ruby-mode) ("[Rr]akefile" . ruby-mode)) auto-mode-alist)) and optionally a ruby-mode-hook for yourself. Here is a subset of mine: (setq ruby-mode-hook (lambda () (define-key ruby-mode-map "\r" 'newline-and-indent) (define-key ruby-mode-map "\M-\C-h" 'backward-kill-word) (setq c-tab-always-indent nil) (abbrev-mode t) (font-lock-mode 1))) Jim -- Jim Menard, jimm@io.com, http://www.io.com/~jimm "I am sure that like Java, [C#] will be a 'no pointer' language, where the most common runtime error will be a 'NULL pointer exception'." -- Jerry Kott, in comp.lang.smalltalk