A reftex-like mode for ruby in emacs?


#1

Hello !

I’m a fervent emacs user, and I’ve been recently amazed and delighted
by the simplicity and ease of use of Reftex, or more specifically
reftex-toc. It is a bit of emacs code that lets you browse through the
table of contents of a LaTeX document. For instance, if I run it on my
PhD, I get something like

[sorry, french…]

1 Introduction
1.1 Où va-t-on ?
1.2 La photosynthèse
1.2.1
Généralités …

I just need to select one line with the cursor, press enter, and I go
to the relevant line in the relevant file.

Does anyone know if something similar is available for Ruby ? Say, you
have a code tree (or even a file), you press a few keys and you get an
outline, with only, say module, classes and method definitions (without
code) and you can select and go there ? I usually find myself looking
for methods more longer than I actually code, that would definitely
help.

Or, at least, would that interest anyone if I tried it ?

Cheers,

Vincent

#2

Vincent F. wrote:

1 Introduction
code) and you can select and go there ? I usually find myself looking
for methods more longer than I actually code, that would definitely help.

Or, at least, would that interest anyone if I tried it ?

Cheers,

Vincent

Well, it’s not Ruby-specific, but the Leo editor has this sort of thing
as its standard modus operandi. It has syntax coloring for nearly all
languages, but its “native” language is Python, and it is both written
in and scripted with Python. It interfaces to either Emacs or Vim as
well. I was enthusiastic about it for a while, but the learning curve is
rather steep for a Vim hacker like myself and the “core team” – one
person, really – is a rapidly-moving target. Anyhow, if you’re
interested, it’s at

http://webpages.charter.net/edreamleo/front.html


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC§
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.


#3

Vincent F. removed_email_address@domain.invalid writes:

1 Introduction
code) and you can select and go there ? I usually find myself looking
for methods more longer than I actually code, that would definitely help.

Or, at least, would that interest anyone if I tried it ?

Try speedbar or maybe imenu.

Or, if nothing helps, M-x occur RET ^\s-*(class|module|def)


#4

Vincent F. wrote:

I just need to select one line with the cursor, press enter, and I go
to the relevant line in the relevant file.

Does anyone know if something similar is available for Ruby ? Say, you
have a code tree (or even a file), you press a few keys and you get an
outline, with only, say module, classes and method definitions (without

Check out the emacs code browser as well (ecb).

–Ian


#5

Christian N. wrote:

Vincent F. removed_email_address@domain.invalid writes:

Or, at least, would that interest anyone if I tried it ?

Try speedbar or maybe imenu.

speedbar doesn’t seem to work with ruby files (?) but imenu is good.
Not yet what I would like, but a great help, thanks !

Vince

#6

Ian Duggan wrote:

Vincent F. wrote:

I just need to select one line with the cursor, press enter, and I go
to the relevant line in the relevant file.

Does anyone know if something similar is available for Ruby ? Say, you
have a code tree (or even a file), you press a few keys and you get an
outline, with only, say module, classes and method definitions (without

Check out the emacs code browser as well (ecb).

Yes, that is great, thanks !

Vince

#7

Vincent F. removed_email_address@domain.invalid writes:

You can probably improve things by setting up exhuberant-tags and
maintaining
tag files of your source trees?

Tim


#8

Kristof B. removed_email_address@domain.invalid writes:

Does anyone know if something similar is available for Ruby ? Say,
For the ri documentation:
http://rubyforge.org/projects/ri-emacs/
(shameless plug :slight_smile:

and I will second that. I only started looking at ruby a few weeks ago.
Since
I’m a long time emacs user, I thought there had to be some sort of
initerface
that would allow me to lookup ruby docs from within emacs with just a
keystroke
or two. I figured either it already exists or I would code it myself.

A quick google found the ri-emacs project and I immediately downloaded
it and
have been using it from within CVS emacs (Emacs 22). It has been very
useful
and helped considerably in handling the learning curve associated with a
new
language.

Thanks.

Tim


#9

Tim X wrote:

For the ri documentation:
http://rubyforge.org/projects/ri-emacs/

Thanks to all of you for your answers. I’ve been looking around, and I
definitely will use ri-emacs, although only the command ri-show-topic
works for me. Other commands fail with
apply: Wrong type argument: stringp, io-error

I’ve looked at the imenu code. Although I don’t like the presentation
at all, I think I can turn it into something very reftex-like, if time
is available.

Thanks again for all your anwers !

Vince

#10

On Wed, 03 Jan 2007 05:07:33 +0900, Vincent F. wrote:

Check out the emacs code browser as well (ecb).

Yes, that is great, thanks !

Vince

For the ri documentation:
http://rubyforge.org/projects/ri-emacs/
(shameless plug :slight_smile:

Kristof


#11

Vincent F. wrote:

Tim X wrote:

For the ri documentation:
http://rubyforge.org/projects/ri-emacs/

Thanks to all of you for your answers. I’ve been looking around, and I
definitely will use ri-emacs, although only the command ri-show-topic
[sorry, oops, ri-show-topic is an old command of my own]