help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Narrow/widen in folding.el


From: Leo Alekseyev
Subject: Re: Narrow/widen in folding.el
Date: Wed, 22 Dec 2010 01:14:12 -0800

>> Now I remember I also tried to do something like this some time ago,
>> but I couldn't stand the fact that I had to use a special syntax for
>> it.
>
> That's what I like with `outline-minor-mode' and my config (i.e. outline
> headings are `comment-start' + one or many *s).  You would comment your
> code anyway (I hope so!), and adding a few * to make a comment a
> headline to make the structure of the file visible is worth it.
>
> But I agree, that I don't like folding.el's obtrusive {{{ ... }}}
> syntax, too.


Hi Tassilo; thanks for the code snippet in your previous message.  In
fact, I had started using outline-minor-mode just in the way you
described, but I manually set up the regexes for the few languages
where I used it, so your code will definitely come in handy.

The problem with this approach, though, is the overly rigid structure:
the end of one fold is necessarily the beginning of another fold.  For
some use cases, it works rather well.  Sometimes, however, I simply
want a piece of text folded without it being logically tied to any
hierarchy.  For instance, I want to hide a header or a footer, or a
long block of commented text in the middle of the document, etc.  In
org-mode, you can achieve this effect by using "drawers", where you
have e.g. a mark-up like :DETAILS: <long block of folding/unfolding
text here> :END:.  In fact, if someone ported that functionality to
outline-minor-mode, I'd probably use that.  Failing this, folding.el
is a good option.  Unfortunately, this brings us back to the original
issue -- folding.el's annoying narrow/widen behavior in isearch.  I am
still hoping someone familiar with folding.el might help clarify the
issue :)

In general, I would say that folding behavior is one area where Emacs
could improve.  If you do a search, you'll find lots of people on
StackOverflow and other forums trying to figure out folding in Emacs.
The problem is the fragmentation of folding mechanisms, and the fact
that each has limits, drawbacks, and/or bugs.  This is remedied to a
point by using fold-dwim, and the new fold-dwim-org.  However, my pipe
dream is that someone will write a end-all folding mode that will roll
into it functionality that's currently scattered across outline minor
mode, folding.el, hideshow, and various enhancements of the above
(hideshow-org, fold-dwim, etc.)

It would probably make the most sense to merge the functionality of
folding.el into outline-minor-mode, and set it up with org bindings,
possibly through fold-dwim-org.  Code folding could be done with
hideshow, although CEDET's folding might be a better option at this
point...

--Leo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]