unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Problems with HideShow
@ 2007-03-06 19:38 kj
  2007-03-08 18:19 ` David Hansen
  0 siblings, 1 reply; 2+ messages in thread
From: kj @ 2007-03-06 19:38 UTC (permalink / raw)
  To: help-gnu-emacs



I desperately need the ability to selectively fold chunks of code
and comments in my source files, and over the years I have tried
various Emacs modes for this, but I always abandon them due to
bugs.  I'm trying once again, this time with hs-minor-mode, but
again, I'm running into bugs.

The most common problem is that the command hs-hide-all fails to
fold some pretty simple/obvious blocks.

For example, if I have a buffer with only this snippet:

if ( x ) {
  y = 0;
}

...hs-hide-all fails to fold the block.

However, if I now move the point so that it is inside the unfolded
block and execute hs-toggle-hiding, the folding happens perfectly.

What's the matter?  I can't understand what's confusing hs-hide-all,
but I'm willing to modify my coding style if this makes it easier
for hs-hide-all to do its job.  Are there any known do's and don't's
for keeping HideShow happy?  FWIW, the major mode in this case is
JavaScript Abbrev.

The other problem I'm having is easier to describe through an
example.  Suppose my code looks like this:

{
  {
    foo();
    bar();
  }
  {
    baz();
  }
}

First I fold the first internal block, so that my screen would look
like this:

{
  {...
  {
    baz();
  }
}

and afterwards I fold the outer block, so that now my screen would
look like this:

{...

My problem now is that I don't know how to undo the last fold to
return to

{
  {...
  {
    baz();
  }
}

Whether I use hs-toggle-hiding or hs-show-all I always end up with
both internal blocks expanded.

Basically I need a "reversible folding" process that somehow
remembers the state of the folded code before folding.  Is this
available already?

Many thanks in advance!

kj

-- 
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problems with HideShow
  2007-03-06 19:38 Problems with HideShow kj
@ 2007-03-08 18:19 ` David Hansen
  0 siblings, 0 replies; 2+ messages in thread
From: David Hansen @ 2007-03-08 18:19 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 6 Mar 2007 19:38:55 +0000 (UTC) kj wrote:

> The most common problem is that the command hs-hide-all fails to
> fold some pretty simple/obvious blocks.
>
> For example, if I have a buffer with only this snippet:
>
> if ( x ) {
>   y = 0;
> }
>
> ...hs-hide-all fails to fold the block.

Works fine here (GNU Emacs 22, currently in pretest).  What Emacs
version are you using?

BTW, there's M-x report-emacs-bug

> Basically I need a "reversible folding" process that somehow
> remembers the state of the folded code before folding.  Is this
> available already?

I don't think so.  But have a look at this page, maybe there's
something interesting for you:

http://www.emacswiki.org/cgi-bin/wiki/CategoryOutline

David

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-08 18:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 19:38 Problems with HideShow kj
2007-03-08 18:19 ` David Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).