Massimiliano Mirra <list / NOSPAMchromatic-harp.com> writes:

> On Mon, Aug 19, 2002 at 02:44:06AM +0900,
> bbense+comp.lang.ruby.Aug.18.02 / telemark.stanford.edu wrote:
> 
> > >> - - I can do all this in Emacs and have a powerful editor. Is it
> > >Same questions to you: how do you have a method's renaming
> propagate,
> 
> > - - You need a ruby version of etags. Then it's just a simple
> >   matter of using tags-query-replace. The hard bit is a ruby
> >   version of etags. 
> 
> I heard about etags supporting ruby, but never managed to get it work,
> 
> probably because I never used etags with any other language and I
> don't know how it is supposed to work when it does.  Sounds like it's
> time for another try.

You roll your own ruby support if your etags doesn't have it (I am
using emacs 21.2.1 and the version of etags supplied doesn't have it).

Here's how to roll your own:
etags -l none --regex='your regex' --regex='your other regex' files

You get the point, you can supply your own regexes that matches what
you want stored in the tags file as ruby definitions.

An example that I use because the etags python support didn't store
method definition (only class names and functions).

etags %s --regex="/[ \t]+def[ ]+\(.+?\)(/\1/"

The point of this regexp is to match a line looking like this
    def theIdentifierThatEtagsWillPutInTheTagsFile(self, *args):

theIdentifierThatEtagsWillPutInTheTagsFile is matched by the first
group in the regex (in fact the only group) and then you tell etags
which group contains the identifier by writing \1 (for the first
group, you might need more if you need to group for or'ing parts of
regexps)


If you use *nix I think you should substitute the enclosing " with '




> I wonder, though, what tags-query-replace does.  If I modify `class
> MyClass; def meth; end; end' into `class MyClass; def new_meth; end;
> end', will the various my_instance.meth throughout the code be changed
> 
> into my_instance.new_meth?  It doesn't seem very likely -- for one
> thing, how would Emacs know that my_instance is an instance of MyClass
> 
> and not anything else?

That's why it's called query, it asks you for each time it finds meth
so you can say yes (or no).

It would be fine if any replies to this posting would be cc'ed to me,
I am more of a python guy currently, but had to check out the group as
Ron Jeffries and Dave Thomas seems to appreciate Ruby a lot.


-- 

Vennlig hilsen 

Syver Enstad