Hello,
More ruby-mode.el fun today. The following bit of code, when run
though imenu-add-menubar-index, only creates menu entries for the
first class. It appears to be the fact that they’re in the same module
that’s breaking it:
module Foo
class Bar
def meth1
end
end
class Baz
def meth2
end
end
end
Dan
···
–
/^Dan Debertin$/
airboss@nodewarrior.org
www.nodewarrior.org
ignorami: n:
The art of folding problem users into representational shapes.
This is better, but still doesn’t do what I expect. The code fragment
I mentioned:
module Foo
class Bar
def meth1
end
end
class Baz
def meth2
end
end
end
is not a case of nested classes, but of multiple classes within the
same module. The menu, however, comes out nested:
Rescan
Foo
Foo::Bar
Foo::Bar::Baz
Foo::Bar#meth1
Foo::Bar::Baz#meth2
Baz is not a nested class under Bar … right?
Dan
···
–
/^Dan Debertin$/
airboss@nodewarrior.org
www.nodewarrior.org
ignorami: n:
The art of folding problem users into representational shapes.
Exactly. ruby-move-to-block was needed to modify to skip RD
style comments.
Works perfectly. Many thanks for your work.
Still this patch doesn’t work well at here documents…
Well, at least for imenu it treated this construction correctly:
class Foo
def initialize
instance_eval <<-EOD
def meth1
end
EOD
end
end
But this causes a spurious def to appear in the index:
class Foo
def initialize
print <<-EOD
def meth1
puts “I’m in a fake method”
end
EOD
end
end
As you can see, indenting also thinks I’m in a def. That sounds like
it would be hard to code around, though.
I’m just happy to have a working Imenu. Thanks again.
Dan
···
/^Dan Debertin$/
airboss@nodewarrior.org
www.nodewarrior.org
ignorami: n:
The art of folding problem users into representational shapes.
Hi,
ruby-mode.el.diff.gz (2.21 KB)
···
At Wed, 24 Jul 2002 01:12:14 +0900, Dan Debertin wrote:
But this causes a spurious def to appear in the index:
class Foo
def initialize
print <<-EOD
def meth1
puts “I’m in a fake method”
end
EOD
end
end
As you can see, indenting also thinks I’m in a def. That sounds like
it would be hard to code around, though.
I see, hope this works.
Well, it’s close ;). Here’s the indentation output:
class Foo
def initialize
print <<-EOD
def foo
end
EOD
end
end
It’s good to see that no bogus method is added to the imenu now
(though it also isn’t added if you define a method under one of the
various _eval methods, and it debatably should be), but as you can
see, it’s not matching up the end-of-here-document token (EOD) and
going back to normal indentation after it.
Dan
···
At Wed, 24 Jul 2002 05:02:51 +0900, nobu.nokada@softhome.net wrote:
I see, hope this works.
–
/^Dan Debertin$/
airboss@nodewarrior.org
www.nodewarrior.org
ignorami: n:
The art of folding problem users into representational shapes.
Hi,
I see, hope this works.
[2 ruby-mode.el.diff.gz <text/x-diff; US-ASCII (base64)>]
Commit them, please.
I found ruby-move-to-block got TOO slow, perhaps because of too
many invocations of ruby-calculate-indent and they caused
backtracks. Once I tried forward scan from the beginning,
however it would get slower in larger files, so abandoned.
After all, reverted ruby-move-to-block almost and modified
ruby-imenu-create-index. Both seem to work reasonalbe now.
-
misc/ruby-mode.el (ruby-delimiter): include here document.
-
misc/ruby-mode.el (ruby-imenu-create-index): fix for nested
classes.
-
misc/ruby-mode.el (ruby-accurate-end-of-block): added. scan a
block in the order.
-
misc/ruby-mode.el (ruby-expr-beg): support for here document.
-
misc/ruby-mode.el (ruby-parse-partial): splitted from
ruby-parse-region.
-
misc/ruby-mode.el (ruby-move-to-block): skips RD style comments.
And do you okay to merge this?
- misc/ruby-mode.el (ruby-deep-arglist): skips spaces after
parenthesis when 'space.
ruby-mode.el.diff.gz (3.11 KB)
···
At Wed, 24 Jul 2002 10:26:35 +0900, Yukihiro Matsumoto wrote: