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

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

Re: Ruby


From: Anselm Helbig
Subject: Re: Ruby
Date: Tue, 12 May 2009 00:06:19 +0200
User-agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.7 Emacs/22.3 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Mon, 11 May 2009 23:59:48 +0400,
Vladimir Passwordoff <passvvordoff@gmail.com> wrote:
> 
> [1  <text/plain; ISO-8859-1 (7bit)>]
> 
> [2  <text/html; ISO-8859-1 (7bit)>]
> Can anyone, who program on Ruby, share the bit of ~/.emacs with ruby 
> configuration, and the ruby-files for emacs? I only install the irb and 
> ruby-mode, but ri, flymode - i
> cannot.

See the emacswiki for setting up flymake

  http://www.emacswiki.org/emacs/FlymakeRuby

I'm using emacs-rails which already sets this up for you:

  http://dima-exe.ru/rails-on-emacs

(I don't really like the fact that emacs-rails configures so much
stuff for you: it's generally easier to turn on a feature you want
than to turn off a feature that you don't want - in the latter case
you don't know where it was activated and what was done to configure
it.)

For ri, I use the fastri gem which includes the `ri-emacs'
executable. Note that you have to start a fastri-server before you can
use it (should be done in some startup script). You still need to get
ri-ruby.el from http://rubyforge.org/projects/ri-emacs/ and put it
somewhere in your emacs load-path:

  (mapc (lambda (func)
          (autoload func "ri-ruby" nil t))
        '(ri ri-ruby-complete-symbol ri-ruby-show-args))

  ;; this only works if ri-emacs can be found in your PATH
  (setq ri-ruby-script (locate-file "ri-emacs" exec-path))

  ;; the default ANSI colours are not really readable with a light background
  (setq ansi-color-names-vector ["black" "red" "#009900" "yellow" "blue" 
"magenta" "#990099" "white"])
  (setq ansi-color-map (ansi-color-make-color-map))

  (add-hook 'ruby-mode-hook
            (lambda ()
              (local-set-key "\M-\C-i" 'ri-ruby-complete-symbol)
              (local-set-key (kbd "<f4>") 'ri-ruby-show-args)))

Apart from the rails-specific stuff I only have these smaler
customizations for ruby:

  ;; allows for navigation by word in camel-cased constants
  (defun turn-on-c-subword-mode () (c-subword-mode 1))
  (add-hook 'ruby-mode-hook 'turn-on-c-subword-mode)

  ;; highlight some keywords
  (font-lock-add-keywords 'ruby-mode
   '(("\\<\\(FIXME\\|HACK\\|XXX\\|FLUNK\\|TODO\\|ToDo\\)" 1
   font-lock-warning-face prepend)))

  ;; highlights matching blocks, get it from
  ;; http://www.emacswiki.org/emacs/ruby-block.el
  (autoload 'ruby-block-mode "ruby-block" nil t)
  (add-hook 'ruby-mode-hook (lambda () (ruby-block-mode t)))

My other customizations are either too specific (rails) or too general
to mention here. 

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


reply via email to

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