help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ruby and emacs


From: Joost Diepenmaat
Subject: Re: ruby and emacs
Date: Tue, 23 Sep 2008 00:47:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

"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 via email to

[Prev in Thread] Current Thread [Next in Thread]