Emacs commands for running Ruby code

F

francisrammeloo

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
 
J

Jeffrey Moss

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: <[email protected]>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <[email protected]>
Sent: Wednesday, August 10, 2005 2:16 PM
Subject: Emacs commands for running Ruby code
 
F

Forrest Chang

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top