I'd love if you could point me to a tutorial on how to use emacs with
ruby. I'm running gentoo, and have installed ruby-mode, but I can't
get anything but syntax highlighting to work. Not auto-tabbing,
imbedded interpreting, etc. As for now, I'm using scite and vim.
Scite's pretty cool. You can install it on OSX, but you'll have to run
it through an XServer, there website doesn't mention a native OSX port.
I am not a MacOSX user, but as far as I know the Carbon Emacs
distribution doesn't require a X server.
Read more about this here:
http://home.att.ne.jp/alpha/z123/emacs-mac-e.html
http://www.emacswiki.org/cgi-bin/emacs-en/EmacsForMacOS
And for the ruby-mode tutorial, I don't know any. But try adding this to
your ".emacs" file:
;;; begining
(autoload 'ruby-mode "ruby-mode" "Ruby mode" t)
(defun my-ruby-run ()
(interactive)
(compile (concat "ruby " (buffer-file-name)))
)
(defun my-ruby-mode-hook ()
(define-key ruby-mode-map "\r" 'ruby-reindent-then-newline-and-indent)
(local-set-key [f9] 'my-ruby-run)
(make-variable-buffer-local 'compilation-error-regexp-alist)
(setq compilation-error-regexp-alist
(append compilation-error-regexp-alist
(list (list
(concat
"\\(.*?\\)\\([0-9A-Za-z_./\:-]+\\.rb\\):\\([0-9]+\\)") 2 3))))
(make-variable-buffer-local 'compile-command)
(setq compile-command (concat "ruby " (buffer-file-name) " "))
(message "My ruby-mode customizations loaded")
))
(add-hook 'ruby-mode-hook 'my-ruby-mode-hook)
(setq auto-mode-alist
(append '(("\\.rb$" . 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)
))
;;;end
This will turn on autoindent and bind F9 to the "compile" command that
will let you run your Ruby program and jump to the possible errors. If
you want to run an embedded Ruby interpreter type "M-x run-ruby" when
editing a .rb file. You can also run your program in the embedded
interpreter by using "M-x ruby-load-file". Look for more informations here:
http://www.emacswiki.org
http://www.rubygarden.org/ruby?EmacsExtensions
Jarek Rzeszótko