unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: kj <socyl@987jk.com.invalid>
To: help-gnu-emacs@gnu.org
Subject: Problems with HideShow
Date: Tue, 6 Mar 2007 19:38:55 +0000 (UTC)	[thread overview]
Message-ID: <eskg0f$klt$1@reader2.panix.com> (raw)



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.

             reply	other threads:[~2007-03-06 19:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-06 19:38 kj [this message]
2007-03-08 18:19 ` Problems with HideShow David Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='eskg0f$klt$1@reader2.panix.com' \
    --to=socyl@987jk.com.invalid \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).