GNU bug report logs - #52092
28.0.60; hs-toggle-hiding does not toggle once folded

Previous Next

Package: emacs;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Thu, 25 Nov 2021 07:42:01 UTC

Severity: normal

Tags: help

Found in version 28.0.60

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 52092 <at> 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
> Date: Thu, 25 Nov 2021 13:10:51 +0530
> From: Mohammed Sadiq <sadiq <at> 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.




This bug report was last modified 2 years and 237 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.