On Aug 15, 2006, at 11:07 AM, John Gabriele wrote: > On 8/15/06, Ryan Davis <ryand-ruby / zenspider.com> wrote: >> >> On Aug 15, 2006, at 9:20 AM, John Gabriele wrote: >> >> > So, how do I get emacs to recognize Ruby? Am I supposed to copy >> one or >> > more of the misc/*.el files to my ~/.emacs.d directory? >> >> Yes, and you want to add ruby-mode.el to the autoload list: >> >> (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") > > I appended those to my ~/.emacs file, but there's still no syntax > highlighting when I open a Ruby source file. > > Also, you mention to add ruby-mode.el to the "autoload list", but you > have three lines above for adding stuff to this autoload list. Are > ruby-mode, run-ruby, and inf-ruby-keys three separate thingies inside > ruby-mode.el? I just copied in some of what I have from my setup... It looks like you need to start poking around in emacs and learn what it is doing. Try: "C-h f autoload RET" to start seeing what args autoload takes. It should be able to answer your question above. > ;; uncomment the next line if you want syntax highlighting > ;;(add-hook 'ruby-mode-hook 'turn-on-font-lock) > > but I've already got that (global-font-lock-mode t nil (font-lock)) in > my ~/.emacs file. Do I need that "add-hook" line too? > > I've tried appending it to the end of ~/.emacs, but still no syntax > highlighting. > > Also, I've read here and there on nntp://gnu.emacs.help that the way > I'm trying to get all spaces (and no tabs at all), with 4-space > indents: > > | '(indent-tabs-mode nil) > | '(tab-width 4) > > is "evil". Am I doing it right? So far, tabs seem to be coming out > just the way I want. :) I've got: (setq tab-width 4 indent-tabs-mode t *shrug* Do note that ruby-mode will use 2 (which is idiomatic) because of: (defcustom ruby-indent-level 2 "*Indentation of ruby statements." :type 'integer :group 'ruby) Stick with 2 and we won't have to kill you. :P > What does ruby-electric do that ruby-mode doesn't? Do they overlap? > What is it about ruby-electric drives you nuts? Again, I suggest you start looking at some lisp and poking around.