Emacs commands for running Ruby code

(francisrammeloo@hotmail.com) #1

Hi all,

I have a question about running Ruby code with emacs.
I figured out how to run a simple program, but I wonder if I am doing
it the right way

First I start an IRB process like this:
   M-x run-ruby

Then I run the sourcefile:
   M-x ruby-load-file
   Load Ruby file: (default Test.rb) c:/Program Files/Gnu Emacs
21.3/bin/Test.rb

Is this the way I should run ruby code? Or is there a better way?

Thanks in advance for any helpful hints.

Best regards,
Francis

(Jeff Moss) #2

I use ruby GUD mode, M-x rubydb
Then you need to type in the filename

That way you can use GUD commands like insert breakpoint, although I haven't found a good way to restart the app.

-Jeff

···

----- Original Message ----- From: <francisrammeloo@hotmail.com>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Wednesday, August 10, 2005 2:16 PM
Subject: Emacs commands for running Ruby code

Hi all,

I have a question about running Ruby code with emacs.
I figured out how to run a simple program, but I wonder if I am doing
it the right way

First I start an IRB process like this:
  M-x run-ruby

Then I run the sourcefile:
  M-x ruby-load-file
  Load Ruby file: (default Test.rb) c:/Program Files/Gnu Emacs
21.3/bin/Test.rb

Is this the way I should run ruby code? Or is there a better way?

Thanks in advance for any helpful hints.

Best regards,
Francis

(Forrest Chang) #3

"francisrammeloo@hotmail.com" <francisrammeloo@hotmail.com> writes:

Hi all,

I have a question about running Ruby code with emacs.
I figured out how to run a simple program, but I wonder if I am doing
it the right way

First I start an IRB process like this:
   M-x run-ruby

Then I run the sourcefile:
   M-x ruby-load-file
   Load Ruby file: (default Test.rb) c:/Program Files/Gnu Emacs
21.3/bin/Test.rb

Is this the way I should run ruby code? Or is there a better way?

        Depends on how you want to code. Running the irb inferior and
zapping lines and loading files into irb is very lisp/REPL- y. You
can run ruby files via emacs compile command. Without any
modification, you can issue the compile command( m-x compile is one 1)
and then replace the default make command with your ruby command,
i.e. ruby -w foo.rb. It wil run the file in a *compilation* buffer
that among other things can allow you to jump to both compile and
runtime errors. I've hacked up mode-compile.el to recognize ruby
(larging by cutting pasting the perl entries and replace perl w/ruby).
What compile mode does is try to intelligently look at the current
buffer and apply the right "compiler"

Forrest

···

Thanks in advance for any helpful hints.

Best regards,
Francis