all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joost Diepenmaat <joost@zeekat.nl>
To: help-gnu-emacs@gnu.org
Subject: Re: ruby and emacs
Date: Tue, 23 Sep 2008 00:47:29 +0200	[thread overview]
Message-ID: <87y71jg5mm.fsf@zeekat.nl> (raw)
In-Reply-To: mailman.19721.1222122917.18990.help-gnu-emacs@gnu.org

"aidy lewis" <aidy.lewis@googlemail.com> writes:

> Hi,
>
> Does anyone know how I set up Ruby syntax highlighting with emacs?

The base ruby install includes ruby-mode. You should probably get that
file plus its support files and put it in your load-path.

The following is some stuff that I've got in my .emacs file. You can
probably get away with just putting the add-to-list and autoload stuff
there.

See also http://www.emacswiki.org/cgi-bin/wiki/RubyMode


(autoload 'ruby-mode "ruby-mode"
  "Mode for editing ruby source files")

(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake$" . 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)))
(autoload 'rubydb "rubydb3x" "Ruby debugger" t)
(add-hook 'ruby-mode-hook 'turn-on-font-lock)

(add-hook 'ruby-mode-hook (lambda ()
			    (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) " "))))


(setq ri-ruby-script "~/.emacs.d/ri-emacs/ri-emacs.rb")
(autoload 'ri "~/.emacs.d/ri-emacs/ri-ruby" nil t)

(add-hook 'ruby-mode-hook (lambda ()
			    (require 'speedbar)
			    (require 'rails)
			    (local-set-key [C-c C-o] 'ri)
			    (local-set-key [M-C-i] 'ri-ruby-complete-symbol)
			    (local-set-key [C-c C-a] 'ri-ruby-show-args)))




-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


       reply	other threads:[~2008-09-22 22:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.19721.1222122917.18990.help-gnu-emacs@gnu.org>
2008-09-22 22:47 ` Joost Diepenmaat [this message]
2008-09-22 21:07 ruby and emacs aidy lewis
2008-09-22 22:40 ` Lennart Borgman (gmail)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y71jg5mm.fsf@zeekat.nl \
    --to=joost@zeekat.nl \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.