From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded Date: Thu, 25 Nov 2021 12:29:54 +0200 Message-ID: <834k807ckd.fsf@gnu.org> References: <178345d38657e8ad3b7cb50b644b1c5c@sadiqpk.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14941"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 52092@debbugs.gnu.org To: Mohammed Sadiq Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 25 11:30:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mqC16-0003f7-Ij for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Nov 2021 11:30:12 +0100 Original-Received: from localhost ([::1]:46222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mqC15-0002Vi-9b for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Nov 2021 05:30:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqC0w-0002Sy-J3 for bug-gnu-emacs@gnu.org; Thu, 25 Nov 2021 05:30:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44329) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mqC0w-0005lt-A6 for bug-gnu-emacs@gnu.org; Thu, 25 Nov 2021 05:30:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mqC0w-0000bT-4d for bug-gnu-emacs@gnu.org; Thu, 25 Nov 2021 05:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Nov 2021 10:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52092 X-GNU-PR-Package: emacs Original-Received: via spool by 52092-submit@debbugs.gnu.org id=B52092.16378362002290 (code B ref 52092); Thu, 25 Nov 2021 10:30:02 +0000 Original-Received: (at 52092) by debbugs.gnu.org; 25 Nov 2021 10:30:00 +0000 Original-Received: from localhost ([127.0.0.1]:55874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mqC0u-0000aq-6g for submit@debbugs.gnu.org; Thu, 25 Nov 2021 05:30:00 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mqC0t-0000aR-Ea for 52092@debbugs.gnu.org; Thu, 25 Nov 2021 05:29:59 -0500 Original-Received: from [2001:470:142:3::e] (port=35788 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqC0n-0005QN-Gt; Thu, 25 Nov 2021 05:29:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=628ALGa6NXUJ78uyriIrr79EOHkoMSQ16nbnX5ipt5s=; b=QRmhIjZ+pjkh oorC6hEoQg8Y8muZeCF6gUWFXmErJ0s0qQBVm6SCPgVDGpmpRq4B1b8l7fMh1Tg34E/IXVPC/V8sf 2tKXywedkmbIOg3BM7mf+G/B2H71dlg0kZrS9iPTWMUd+BFhPfoQL4rtKiK+bGW+tuKlzT4k7yeXR nY4wD3Px36Qb1T/cAvWn38X5+JQg6QvP9g5ADjZLUju/hehmiocx8jCswOXWb4DolGj8g8+kPvVjQ PLLhayEygWpOrpvM7p8I4PEjP+wLEfg8+0A35KCEqMYXxSEYoRGdRXJtsANmlwZWldyduAGMi43J7 8wN0sr5vv06PB6qPO2LcXA==; Original-Received: from [87.69.77.57] (port=3955 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqC0n-0004u6-3I; Thu, 25 Nov 2021 05:29:53 -0500 In-Reply-To: <178345d38657e8ad3b7cb50b644b1c5c@sadiqpk.org> (message from Mohammed Sadiq on Thu, 25 Nov 2021 13:10:51 +0530) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:220807 Archived-At: > Date: Thu, 25 Nov 2021 13:10:51 +0530 > From: Mohammed Sadiq > > > 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.