3

Possible Duplicate:
Emacs equivalent of Vim's foldmethod = indent

JEdit has a mode (specifically, folding mode: indent, in Options) that lets you fold code blocks based purely on indentation. It does not require any additional configuration, or knowledge of the language you are using.

That is, if you have code like this:

  foo
     bar
     blah
  oof

and the cursor is on the second or third line, and you tell JEdit to fold, those two lines will be hidden.

I have read similar SO questions, but I haven't found anything in emacs that "just works", for any buffer, like JEdit's code folding does.

I have specifically tried Fold Dwim. It doesn't work for me. It folds right to the end of the buffer, for some reason, which is utterly useless.

Community
  • 1
  • 1
Robin Green
  • 32,079
  • 16
  • 104
  • 187

2 Answers2

0

Take a look at minor mode folding-mode

Giann
  • 3,142
  • 3
  • 23
  • 33
  • 1
    That doesn't "just work". You have to mark what you want it to fold. I want something that automatically detects what to fold based on indentation. – Robin Green Jul 01 '11 at 09:09
0

OutlineMinorMode works for me, though I've only used it with LaTeX. AFAIK it won't fold based on indentation (someone correct me if I'm wrong please) but on keywords etc that you've configured as marking a foldable section.

Edit: This looks relevant.

jaybee
  • 1,897
  • 2
  • 16
  • 29