Folding editor for ruby code browsing

A

Andrew Walrond

I need to fold the code so that I can get a handle on the overall structure;
basically to tidy up and and move whole public methods into protected or
private sections, that sort of thing.

I've tried browsing the code in Kate (xemacs is my usual home) which supports
folding of ruby code. But it's folding is very buggy and I seem to lose whole
portions of a file into a fold without warning. I can't find any good folding
solutions for xemacs. What about vim, or other open source editors (for
linux)?

Recommendations?

Andrew Walrond
 
T

Thomas Kirchner

--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* On Apr 25 6:46 said:
What about vim, or other open source editors (for linux)?
=20
Recommendations?

Vim is excellent at folding (along with pretty much everything else).
You can fold by any number of methods, including indent, marker,
expression, syntax, diff-style, or even manual... Give it a shot if
you're not too die-hard with emacs.
Tom

--1yeeQ81UyVL57Vl7
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCbBWE/rVdTqQq7OwRAmG2AJ95FGPujiMBp/7icxgrNKzaDAruowCfWYX4
Q1i2+6GUc1Dqa91fEm53viU=
=qaGI
-----END PGP SIGNATURE-----

--1yeeQ81UyVL57Vl7--
 
C

Curt Hibbs

Andrew said:
I need to fold the code so that I can get a handle on the overall structure;
basically to tidy up and and move whole public methods into protected or
private sections, that sort of thing.

I've tried browsing the code in Kate (xemacs is my usual home) which supports
folding of ruby code. But it's folding is very buggy and I seem to lose whole
portions of a file into a fold without warning. I can't find any good folding
solutions for xemacs. What about vim, or other open source editors (for
linux)?

Recommendations?

Try the open source FreeRIDE IDE:

http://freeride.rubyforge.org/

It not only does code folding, but also has a source browser - a
clickable tree control that let's you see and navigate your ruby code by
its structure (module/class/method). It also has interactive Ruby
documentation.

Best of all, it written entirely in Ruby and is open source!

Curt
 
F

Florian Groß

Andrew said:
I need to fold the code so that I can get a handle on the overall structure;
basically to tidy up and and move whole public methods into protected or
private sections, that sort of thing.

Recommendations?

jEdit with the Ruby plug in does this quite well. There's other folding
options like by-indentation as well.
 
G

gabriele renzi

Andrew Walrond ha scritto:
I need to fold the code so that I can get a handle on the overall structure;
basically to tidy up and and move whole public methods into protected or
private sections, that sort of thing.

I've tried browsing the code in Kate (xemacs is my usual home) which supports
folding of ruby code. But it's folding is very buggy and I seem to lose whole
portions of a file into a fold without warning. I can't find any good folding
solutions for xemacs. What about vim, or other open source editors (for
linux)?

Recommendations?

SciTE does folding quite well (especially if you get the more rubyish
lexers, the old one did some strange pythonic things).
 
A

Andrew Walrond

--Boundary-00=_7mLbCZ9NJX4gsuv
Content-Type: Multipart/Mixed;
boundary="Boundary-00=_7mLbCZ9NJX4gsuv"

--Boundary-00=_7mLbCZ9NJX4gsuv
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Vim is excellent at folding (along with pretty much everything else).
You can fold by any number of methods, including indent, marker,
expression, syntax, diff-style, or even manual... Give it a shot if
you're not too die-hard with emacs.
Tom

Vim fell at the first hurdle; syntax colouring/highlighting :(
It seems unhappy with IO#<< unless I put some spaces around it; Try the
attached file.

I have downloaded the latest syntax/ruby.vim file, but no change.

Haven't tried folding yet

Andrew

--Boundary-00=_7mLbCZ9NJX4gsuv
Content-Type: application/x-ruby;
name="test.rb"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="test.rb"

def bash(cmd,username=nil,stdin=nil)
pid = Process.fork {
#The process cannot regain superuser status after User.real
if username then User.real(username); else User.realise(); end
puts("\n"+'-'*cmd.size+"\n",cmd,'.'*cmd.size+"\n")
begin
if stdin
IO.popen(cmd,"w+") { |f|
f<<stdin
f.close_write
while s=f.gets(nil); puts(s); end
}
else
raise unless system(cmd)
end
rescue
puts(('*'*24)+" FAILED "+('*'*24))
exit 1
end
exit 0
}
raise cmd unless Process.waitpid2(pid)[1] == 0
end

--Boundary-00=_7mLbCZ9NJX4gsuv--
--Boundary-00=_7mLbCZ9NJX4gsuv--
 
M

Michael Ulm

Andrew said:
Vim fell at the first hurdle; syntax colouring/highlighting :(
It seems unhappy with IO#<< unless I put some spaces around it; Try the
attached file.

The syntax highlighting engine parses the line
f<<stdin
as the beginning of a Here Document. This would go away if you
put a space after the << (makes the code more readable too IMO).

As a fix (especially if you don't use Here Documents anyway) you
can comment out the lines in the Here Document section of the
ruby.vim file; actually, commenting out only the first line there,
(the one containing the expression '<<\z' (without the quotes))
should work too.

HTH,

Michael

--
Michael Ulm
R&D Team
ISIS Information Systems Austria
tel: +43 2236 27551-219, fax: +43 2236 21081
e-mail: (e-mail address removed)
Visit our Website: www.isis-papyrus.com
 
S

Stefan Lang

I need to fold the code so that I can get a handle on the overall
structure; basically to tidy up and and move whole public methods into
protected or private sections, that sort of thing.

I've tried browsing the code in Kate (xemacs is my usual home) which
supports folding of ruby code. But it's folding is very buggy and I seem to
lose whole portions of a file into a fold without warning. I can't find any
good folding solutions for xemacs. What about vim, or other open source
editors (for linux)?

Recommendations?

Andrew Walrond

What version of Kate/KDE are you using?
If you can show me specific code snippets for which syntax highlighting or
code folding fails, I can probably correct them.

Stefan
 
A

Andrew Walrond

What version of Kate/KDE are you using?
If you can show me specific code snippets for which syntax highlighting or
code folding fails, I can probably correct them.

2.3.2

I'll mail you the offending file off-list (because its too big for the ML, not
because its confidential)

Andrew
 
J

Joe Van Dyk

Vim is excellent at folding (along with pretty much everything else).
You can fold by any number of methods, including indent, marker,
expression, syntax, diff-style, or even manual... Give it a shot if
you're not too die-hard with emacs.

Any online places that discuss vim folding? Or general vim tips, for
that matter?
 
K

kyu

Andrew said:
Thaks for the pointer, but I was really looking for something that doesn't
involve adding any special 'fold mark' comments into the code.

Andrew
Hmm, i was trying to get it folding on def/end lines, but it's not going
along with my plan, there must be a simple way to do this, have you
tried cedet/ecb? It wouldn't suprise me if there is folding stuff in
there, although it might take a bit of lisping to setup for ruby.
 
K

kyu

kyu said:
Hmm, i was trying to get it folding on def/end lines, but it's not
going along with my plan, there must be a simple way to do this, have
you tried cedet/ecb? It wouldn't suprise me if there is folding stuff
in there, although it might take a bit of lisping to setup for ruby.
I got it going with cedet/ecb, i simply installed them both (to
/usr/share/emacs/site-lisp/) and added this: to my .emacs

;; Emacs Code Browser / CEDET


(load-file "/usr/share/emacs/site-lisp/cedet/common/cedet.el")
(semantic-load-enable-code-helpers)

(add-to-list 'load-path
"/usr/share/emacs/site-lisp/ecb")

(load-file "/usr/share/emacs/site-lisp/ecb/ecb.el")

(require 'ecb)

Then after emacs has started type M-x ecb-activate, you should have a
window on the left hand side which shows a list
of classes(and methods), buffers, source files in current tree and a
directory view. I can't find folding support but i can't imagine how
you'd need it with that list (third button click also takes you to each
part)If you're still nonplussed i'll send you a screenshot if you like.
Hope this helps.

-kyu
 
J

Jim Menard

Andrew said:
Thaks for the pointer, but I was really looking for something that doesn't
involve adding any special 'fold mark' comments into the code.

You can tell emacs to hide anything that's indented farther than X characters
in any buffer. set-selective-display (C-x $) hides lines with indentation >
count, or shows everything if you don't give it a count. See the docs for that
function for more information.

Jim
 
S

Saynatkari

Le 24/4/2005 said:
I need to fold the code so that I can get a handle on the overall structure;
basically to tidy up and and move whole public methods into protected or
private sections, that sort of thing.

I've tried browsing the code in Kate (xemacs is my usual home) which supports
folding of ruby code. But it's folding is very buggy and I seem to lose whole
portions of a file into a fold without warning. I can't find any good folding
solutions for xemacs. What about vim, or other open source editors (for
linux)?

Recommendations?

After some playing around with various of the more graphically
oriented IDEs, kdevelop is currently my favourite for Linux use.
I have never been much for VIm or Emacs, although I should
probably learn them, huh?

As a matter of principle I would also like to plug Mondrian,
a pure-ruby IDE with a bunch of promise (albeit no folding).

Will folding enable you to finish Heretix faster? :)
Andrew Walrond

E
 
A

Andrew Walrond

But I climbed back on, charged around aintree and won the national by a
nose...

I spent a few hours feeling like somebody had chopped my arms off, but now I'm
getting to grips with vims modal system. I _really_ like vim's syntax based
folding mechanism (set foldmethod=syntax).

For that feature alone, I think vim might just become my editor of choice.

Graphical only editors and IDEs are great, but a significant amount of my work
is done via ssh, so I really need an editor that works well in both
environments.

Andrew
 
A

Andrew Walrond

Vim is excellent at folding (along with pretty much everything else).
You can fold by any number of methods, including indent, marker,
expression, syntax, diff-style, or even manual... Give it a shot if
you're not too die-hard with emacs.
Tom

Vim is *awesome* at folding. And *awesome* at everything else I have tried so
far. I wish I had spent a day learning vim _years_ ago.

Its a bit like snow-boarding; I put off learning for ages (because I didn't
want to waste a holiday) But I haven't put on skis since I tried it ;)

_Sincere_ thanks for the recommendation!

Andrew Walrond
 

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
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top