I've gotten a bit spoiled using Emacs with SLIME while learning Lisp.
It can evaluate individual expressions[0] within the file being edited,
making it easy to test things in very small increments. The evaluations
occur in the same image as a REPL buffer (like irb) within the editor.
I would like something similar for Ruby, but I haven't been able to
find anything. This seems like the sort of functionality that would be
in most Ruby-specific IDEs, but it doesn't appear to be. It also seems
like the sort of thing someone would have written in to an Emacs mode,
but I haven't found one.
[0]In Lisp, a function definition, class definition, etc... is a single
expression, with subexpressions. I'm not quite sure how the terminology
translates to Ruby, but I want to be able to evaluate everything
between def and end.
I've gotten a bit spoiled using Emacs with SLIME while
learning Lisp. It can evaluate individual expressions
within the file being edited, making it easy to test
things in very small increments.
The Emacs mode that comes with Ruby does this.
See `ruby-send-region', bound to C-c C-r by default.
There's also `ruby-send-definition', bound to C-c C-x,
and `ruby-send-block', bound to C-c C-b. To go to the
Ruby REPL (an IRB session), type C-c C-s.
There's also the handy C-c M-r, C-c M-x and C-c M-b, which
do the same thing as the aforementioned `ruby-send-*'
commands but also switch to the REPL buffer for you.
[...]
In Lisp, a function definition, class definition,
etc... is a single expression, with subexpressions.
I'm not quite sure how the terminology translates to Ruby
No translation necessary.
Just about everything in Ruby is an expression.
···
--
Daniel Brockman <daniel@brockman.se>
So really, we all have to ask ourselves:
Am I waiting for RMS to do this? --TTN.
Thanks. I'd blame myself for not reading the documentation, but there
doesn't appear to be any with the ruby1.8-elisp Debian package. It does
exactly what I want, now that I know how to use it.
What a pleasant newsgroup - I double-posted a stupid question, but got
a useful response and no flames
Emacs lisp packages typically have the documentation in the elisp package itself. In any emacs buffer, the describe-mode emacs function, bound to "C-h m" or "F1 m", gives some documentation for the current major and minor modes. So, if you're editing a a ruby file in emacs and run describe-mode, you get documentation for ruby-mode, which includes keybindings.
Adam
···
zak.wilson@gmail.com wrote:
Thanks. I'd blame myself for not reading the documentation, but there
doesn't appear to be any with the ruby1.8-elisp Debian package. It does
exactly what I want, now that I know how to use it.
What a pleasant newsgroup - I double-posted a stupid question, but got
a useful response and no flames
Emacs lisp packages typically have the documentation in the elisp
package itself. In any emacs buffer, the describe-mode emacs function,
bound to "C-h m" or "F1 m", gives some documentation for the current
major and minor modes. So, if you're editing a a ruby file in emacs and
run describe-mode, you get documentation for ruby-mode, which includes
keybindings.
Adam
When I tried that, shortly pefore posting my original question, it gave
me an error message about not being able to access the file containing
the documentation. The problem seems to have gone away, maybe as a
result of restarting Emacs.