unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Mohammed Sadiq <sadiq@sadiqpk.org>
Cc: 52092@debbugs.gnu.org
Subject: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded
Date: Thu, 25 Nov 2021 12:29:54 +0200	[thread overview]
Message-ID: <834k807ckd.fsf@gnu.org> (raw)
In-Reply-To: <178345d38657e8ad3b7cb50b644b1c5c@sadiqpk.org> (message from Mohammed Sadiq on Thu, 25 Nov 2021 13:10:51 +0530)

> Date: Thu, 25 Nov 2021 13:10:51 +0530
> From: Mohammed Sadiq <sadiq@sadiqpk.org>
> 
> 
> With hs-minor-mode enabled, I could hide the visibility of a block with
> hs-toggle-hiding, but using it again doesn't unfold the region.
> 
> Tested with c-mode and css-mode.

It seems that unhiding works only if you are at the beginning of the
hidden block.  In C Mode, that means cursor is on the opening brace of
the block.

The problem seems to be inside hs-already-hidden-p:

  (defun hs-already-hidden-p ()
    "Return non-nil if point is in an already-hidden block, otherwise nil."
    (save-excursion
      (let ((c-reg (hs-inside-comment-p)))
	(if (and c-reg (nth 0 c-reg))
	    ;; point is inside a comment, and that comment is hideable
	    (goto-char (nth 0 c-reg))
	  (end-of-line)

That call to end-of-line moves point outside of the braces _unless_
point is on the left brace that starts the hidden block.  That
movement then makes it appear as if we are in the outer block, not in
the one that you've just hidden.

I don't know enough about hideshow.el and don't use it enough to
propose a robust enough solution for this which won't break some use
case out there.





  reply	other threads:[~2021-11-25 10:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25  7:40 bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded Mohammed Sadiq
2021-11-25 10:29 ` Eli Zaretskii [this message]
2022-09-19  6:31 ` kobarity
2022-09-23 22:01   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-24  5:59     ` kobarity
2022-09-24 15:10       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-25  2:26         ` kobarity
2022-09-24  6:17     ` Eli Zaretskii
2022-09-24 15:11       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=834k807ckd.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=52092@debbugs.gnu.org \
    --cc=sadiq@sadiqpk.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).