GNU bug report logs - #79616
[PATCH] hideshow: Update the indicators properly after using hs-hide/show-all commands

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Elijah Gabe Pérez <eg642616@HIDDEN>; Keywords: patch; Done: Juri Linkov <juri@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 31.0.50, send any further explanations to 79616 <at> debbugs.gnu.org and Elijah Gabe Pérez <eg642616@HIDDEN> Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 79616 <at> debbugs.gnu.org:


Received: (at 79616) by debbugs.gnu.org; 21 Oct 2025 06:35:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 21 02:35:32 2025
Received: from localhost ([127.0.0.1]:49531 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vB5xz-0008A2-MT
	for submit <at> debbugs.gnu.org; Tue, 21 Oct 2025 02:35:32 -0400
Received: from mout-p-201.mailbox.org ([80.241.56.171]:42026)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1vB5xw-00089N-9k; Tue, 21 Oct 2025 02:35:29 -0400
Received: from smtp202.mailbox.org (smtp202.mailbox.org
 [IPv6:2001:67c:2050:b231:465::202])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4crMx40jh3z9t8m;
 Tue, 21 Oct 2025 08:35:20 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1761028520;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=hcm8rfSIDSKZw163FhNHC3ztLIbqCaYIxabGry8geyk=;
 b=11UQTsNf14HbJdMUwLejibulmcL0kWm+15llFk+NHqceBa9YWtLmc596t/jdVdUDKZ1Vmd
 oBDfKOxyuAvo0csY+813hJR/5b9dbqjRJ/fi2MLsvY8GdjvmNAg3TU8wprzCAD4b8xjkkM
 mbFuetPEq6MUY/BrqVGz0NCMK5EToNBcTLGCkXA3KymiG31Z3QztEYH6wI/njcDFp4hEQ2
 QGYq8OA+dggTLczld3EoyIdENnUFlXOaneqdgZumTuTBAN/jtX7WZgdBxAhb1vOOcNT/YD
 15Im3sklfZmNjcIKZ5Nv3D9hQ4Q75rmud0XKgHrieQ52t6FZ79wD9dzDcBKXrw==
Authentication-Results: outgoing_mbo_mout; dkim=none;
 spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
 2001:67c:2050:b231:465::202 as permitted sender)
 smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= <eg642616@HIDDEN>
Subject: Re: bug#79616: [PATCH] hideshow: Update the indicators properly
 after using hs-hide/show-all commands
In-Reply-To: <87ikg981vi.fsf@HIDDEN>
Organization: LINKOV.NET
References: <87plassyqb.fsf@HIDDEN> <877bx0bptj.fsf@HIDDEN>
 <87ecr58d73.fsf@HIDDEN> <87ikg981vi.fsf@HIDDEN>
Date: Tue, 21 Oct 2025 09:34:03 +0300
Message-ID: <87frbcn4pw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4crMx40jh3z9t8m
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79616
Cc: 79616 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

close 79616 31.0.50
thanks

> Sending here an updated patch with the recent changes in master:

Thanks, now pushed and closed.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79616; Package emacs. Full text available.

Message received at 79616 <at> debbugs.gnu.org:


Received: (at 79616) by debbugs.gnu.org; 21 Oct 2025 01:44:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 20 21:44:46 2025
Received: from localhost ([127.0.0.1]:48452 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vB1Qb-0000GM-Fr
	for submit <at> debbugs.gnu.org; Mon, 20 Oct 2025 21:44:45 -0400
Received: from mail-oo1-xc41.google.com ([2607:f8b0:4864:20::c41]:44371)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1vB1QZ-0000FV-2X
 for 79616 <at> debbugs.gnu.org; Mon, 20 Oct 2025 21:44:43 -0400
Received: by mail-oo1-xc41.google.com with SMTP id
 006d021491bc7-651c77805b7so2195093eaf.1
 for <79616 <at> debbugs.gnu.org>; Mon, 20 Oct 2025 18:44:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1761011076; x=1761615876; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=83oOwijLmZ1gR2U/f5T/SLc7QmelMXguKkcjexwYJeU=;
 b=A71pKf84gmwKPQ+ZHDiuxaf+bxcLsH2AYKhJHJr/r1IL07R794aYUsWvhdh4VyH5ff
 D/i9ehF7m08dxikFpnSd+SJDUW3qYrGAyurSS3gy5v5kizR++PqGlVCRLev1OAzBwiwW
 cSTN7uzai1JehiKcOsY03QYYwxrahq8OI6WFNzijHzPa9QElRqPiqXl2eW5EeyBzpfks
 IOrd2UiT0hOJAReEPB9au2RDa6s3Q/JbaUSRUKGcxgkuNZ/YgEACfG/MhLitsUO8rD8y
 H8l0AP82lf3hkCwHXmLGSX4dyaLSQwXwSc2Qm3GXSfnT9RbxE+7EjPwxxSO1zZUjJy59
 O59w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1761011076; x=1761615876;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=83oOwijLmZ1gR2U/f5T/SLc7QmelMXguKkcjexwYJeU=;
 b=XJpjMq40JaXeHmxiyIi0Ql0kucAf2u5FMmXYEtR04BFg03s+iAC1oC0Fa5gLWo/upe
 sO0FMKc3TcUIiZkDngQoxzxN9m3mHQSw65KxVMNwX8Zm+gUqsbj79SqINApcc5ul0CAH
 fZ1LZOQxsHvMMB9bEl34MapjNoBexFJ79CBZIiu94xIclaDV6J1gFgIpINcAMCsONei8
 wf9ZZr7DqOsjmenzCeikXssFozSnT7H7KS9GwgPqDqrfGLZNuYOtI8khCGybb1CZfMrG
 LXqssrBKF3Jjy5QviL+9e1ajI754pyWrluWM6q7xuZRYzhq65fToTlEs41R4eofBKlrF
 kqkw==
X-Gm-Message-State: AOJu0YzkhimlGzmGCQXCRkfZwdjoamgAJPs+FGMj9g6TkvICoZ5vU78J
 65VtzmMZMup7OSXJhlCObup4eHO0gh/EJOv1cyr8VLtRqwjyo+sYeavCwCZO67bt
X-Gm-Gg: ASbGncvMPl1lie2MZ9yiKFs03JNM1Tw71iKR/mOinEAbzUcWN6xwlpKCVYOL7Ee3zzz
 Ys8WecQS7O2SCmdhVfAKKW7MqUEOZr/3VoaVhYpRla0HJhQlqm7B0Tnq7W3XAZyrBsK7JzYCIUP
 x9SmHX3fDm+bKktT5ClWH/UmaURBzpCoB+06Rxswms4fJgNE1WOhDxZ82iMiTR9Jd/UXi5tCR5h
 byyYFp5D5y+C5TgI9H53sK+ttRUXI3SmcBuaheE/XzJR6rQjtecCQrBjWwjcj/gun1xHu/roRsp
 /T1Crpiwh61C+rGRT+q5e2huRUWNNlr4RPg+Sz3LR+Qv62TeQOmssezOWF0mK6t1wZw3RT0hfgK
 Y664V2po9W43JFOO9g977i3iN0uXwm/KNs+jftlzujxvxY+7/noCOMNPk9/LFXBw3WwSyZQ==
X-Google-Smtp-Source: AGHT+IFGpbhbB/RSJySQODL1qiZtQH+bivWD5CKanlRyUHNjf5ahQiKhoyzfI8SC2CHVF/F+qN2ltQ==
X-Received: by 2002:a05:6820:1e85:b0:651:c2a7:8b1 with SMTP id
 006d021491bc7-651c7d33f7bmr5771454eaf.1.1761011076561; 
 Mon, 20 Oct 2025 18:44:36 -0700 (PDT)
Received: from fedora ([189.215.161.189]) by smtp.gmail.com with ESMTPSA id
 006d021491bc7-651d7cc4b60sm2222474eaf.3.2025.10.20.18.44.35
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 20 Oct 2025 18:44:35 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#79616: [PATCH] hideshow: Update the indicators properly
 after using hs-hide/show-all commands
In-Reply-To: <87ecr58d73.fsf@HIDDEN>
References: <87plassyqb.fsf@HIDDEN> <877bx0bptj.fsf@HIDDEN>
 <87ecr58d73.fsf@HIDDEN>
Date: Mon, 20 Oct 2025 19:44:33 -0600
Message-ID: <87ikg981vi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 79616
Cc: 79616 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--=-=-=
Content-Type: text/plain


Sending here an updated patch with the recent changes in master:


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-hideshow-Update-the-indicators-properly-after-showin.patch

From 36a607a9a103ed52d2b673fcc0d4e31ee5ba0e0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN>
Date: Sat, 11 Oct 2025 19:10:11 -0600
Subject: [PATCH] hideshow: Update the indicators properly after
 showing/hidding

bug#79616

* lisp/progmodes/hideshow.el (hs-discard-overlays)
(hs-make-overlay, hs-show-block): Rework
'hs--refresh-indicators' calls.
(hs--refresh-indicators): Rework code, add new function
arguments.
(hs-minor-mode): Properly remove the indicators after turning
off the mode.
---
 lisp/progmodes/hideshow.el | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index 6d3a5bc9fe6..dd6f4d3fef7 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -634,7 +634,8 @@ hs-discard-overlays
             (delete-overlay ov))))
     (dolist (ov (overlays-in from to))
       (when (overlay-get ov 'hs)
-        (delete-overlay ov)))))
+        (delete-overlay ov))))
+  (hs--refresh-indicators from to))
 
 (defun hs-hideable-region-p (beg end)
   "Return t if region in BEG and END can be hidden."
@@ -680,6 +681,7 @@ hs-make-overlay
       (overlay-put ov 'isearch-open-invisible-temporary
                    'hs-isearch-show-temporary))
     (when hs-set-up-overlay (funcall hs-set-up-overlay ov))
+    (hs--refresh-indicators b e)
     ov))
 
 (defun hs-block-positions ()
@@ -785,14 +787,12 @@ hs--add-indicators
     (forward-line 1))
   `(jit-lock-bounds ,beg . ,end))
 
-(defun hs--refresh-indicators ()
-  "Update indicators appearance at current block."
-  (when hs-show-indicators
+(defun hs--refresh-indicators (from to)
+  "Update indicators appearance in FROM and TO."
+  (when (and hs-show-indicators hs-minor-mode)
     (save-match-data
       (save-excursion
-        ;; Using window-start and window-end is more faster
-        ;; than computing again the block positions
-        (hs--add-indicators (window-start) (window-end))))))
+        (hs--add-indicators from to)))))
 
 (defun hs--get-ellipsis (b e)
   "Helper function for `hs-make-overlay'.
@@ -1235,6 +1235,7 @@ hs-show-block
                ((eq 'comment (overlay-get ov 'hs)) here)
                (t (+ (overlay-start ov) (overlay-get ov 'hs-b-offset)))))
         (delete-overlay ov)
+        (hs--refresh-indicators (overlay-start ov) (overlay-end ov))
         t))
     ;; not immediately obvious, look for a suitable block
     (let ((c-reg (hs-inside-comment-p))
@@ -1251,7 +1252,6 @@ hs-show-block
       (when (and p q)
         (hs-discard-overlays p q)
         (goto-char (if end q (1+ p))))))
-   (hs--refresh-indicators)
    (run-hooks 'hs-show-hook)))
 
 (defun hs-hide-level (arg)
@@ -1354,12 +1354,12 @@ hs-minor-mode
           (jit-lock-register #'hs--add-indicators)))
 
     (remove-from-invisibility-spec '(hs . t))
-    (when hs-show-indicators
-      (jit-lock-unregister #'hs--add-indicators)
-      (remove-overlays nil nil 'hs-indicator t))
     ;; hs-show-all does nothing unless h-m-m is non-nil.
     (let ((hs-minor-mode t))
-      (hs-show-all))))
+      (hs-show-all))
+    (when hs-show-indicators
+      (jit-lock-unregister #'hs--add-indicators)
+      (remove-overlays nil nil 'hs-indicator t))))
 
 ;;;###autoload
 (defun turn-off-hideshow ()
-- 
2.51.0


--=-=-=
Content-Type: text/plain


-- 
- E.G via Gnus and Org.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79616; Package emacs. Full text available.

Message received at 79616 <at> debbugs.gnu.org:


Received: (at 79616) by debbugs.gnu.org; 14 Oct 2025 20:02:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 14 16:02:19 2025
Received: from localhost ([127.0.0.1]:44087 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v8lDu-0008DC-ND
	for submit <at> debbugs.gnu.org; Tue, 14 Oct 2025 16:02:19 -0400
Received: from mail-yw1-x1142.google.com ([2607:f8b0:4864:20::1142]:43362)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1v8lDe-0008B6-RR
 for 79616 <at> debbugs.gnu.org; Tue, 14 Oct 2025 16:02:08 -0400
Received: by mail-yw1-x1142.google.com with SMTP id
 00721157ae682-743ba48eb71so4842977b3.1
 for <79616 <at> debbugs.gnu.org>; Tue, 14 Oct 2025 13:02:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1760472115; x=1761076915; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=8oq89FaIjX+4hxE+7tb/dadKgVVk+hd4SthRbN4fGwI=;
 b=Y7EkbDYlQaQSxRK7MJI0rkEIp2D6zveyQjOXZGAKqSkPc9/LYpyknQP8GgmIrhmPUI
 gdS/BVfZfCyr0P8BFypk0y+WUppxJJW01wkmsRpTTZlrp9QI8R2k4pONgk6c90Q1/9P+
 9qDR9yUN5qtrYcEvi+9cO5vpApD9A91ajIUe7T81f9TO94/xKRyw8jEgHw6esWVfH/48
 fYCSaeZ2xJZyB2eiQGWozC2a1BhTs1dTEqzwJPpZM+4lSMhFGcXCrcuWKAvKGQkX7o0H
 lienEmkdZDb2MjcaJDG/K20qvcN8M0VIUFeM+8WVGVp94a/lJsCRN+IUNMj2tyfg44k5
 0DTg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1760472115; x=1761076915;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=8oq89FaIjX+4hxE+7tb/dadKgVVk+hd4SthRbN4fGwI=;
 b=WwtrbhJ36GFb/+Ud13dpAn5ggc84MvWzVgr6F4/bUB2qP75adDFYwsDsis9pKeYY/D
 8tMq1ZEgtbmifhegLcmW0+ownnEs+O62ibD330VJbEGNOp6GwqSohOWFnwlxwLYgO3eG
 n24LkdD7BjW8+tgxIpenXUCGhkQ1DCVzvuGDTkjjF/YwemlU9HhBltsp5rDl/9szY2XC
 CLFypc+Q+H0nyp21RF6DCMqHBrMSQUql6kz5bIVQWZQf2c+kJWUE3aK0Fx+5YJn6ZoD1
 SZUA6IXiRoABx4RXcZqzXrxwToxVwqyVOk84JplKeTSscFBMNJYQFCZYttcXHaj5Ijmd
 trVg==
X-Gm-Message-State: AOJu0YzvW99me/qSarfOxuTHsErfzW8eo/OvulXZ7DLgxUoANX/D07Fp
 DmZ3RiHK3k0cCT9Y6NZnJiAw+zA1KvwW0tfeQFHWbfaoJvO6/W3PIm7KxrNDzw0E
X-Gm-Gg: ASbGnctFBD7dbGdVcjABG+BJ9NCkGG4cRKgBmXgIPV8SjbHLhq/RjRWzBH1pJvPmsfo
 zSoxYk6gSTr++S7T9UVZ6AwgROTiaBEw2NDzsixxaYfO9YUjyyE24gTItNt7klHPQLI1/SO5avd
 V7MTz3ISH1n9IBOX9s0KL57EtD9UMTBTKUM0NnNMT1Znpm4j3ShA6puEep6D2lGj37XNLz0glda
 nwyXyD6Bn4KikQGVf9pZbcDMNX5AoY15fo4lsiraVRQ/A4Mxa0fjwFqYgGSMSBLCm+TBUbdYGSC
 ftQV4oYNhUT+ydsvg5oEU2ocIGp9fFiKjjQaQ7U6lJOD5lwW3dUpOJ8jJje2yTn5HqsqDKb3fOM
 MiqpWZixUpbl2IX4CfHlwac9AacDtR6RpTXw=
X-Google-Smtp-Source: AGHT+IHMHDSpDl05abHFRlkD1Pitq2GvCywOo+RtlQxnsrLqld8cLhlgHIFwNHuuhm5kzug3eek1HQ==
X-Received: by 2002:a05:690e:1c9:b0:635:34f5:51a4 with SMTP id
 956f58d0204a3-63cbe0f57bamr20354006d50.13.1760472114983; 
 Tue, 14 Oct 2025 13:01:54 -0700 (PDT)
Received: from fedora ([189.215.161.189]) by smtp.gmail.com with ESMTPSA id
 956f58d0204a3-63cd95e3f9asm5013316d50.21.2025.10.14.13.01.53
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 14 Oct 2025 13:01:54 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#79616: [PATCH] hideshow: Update the indicators properly
 after using hs-hide/show-all commands
In-Reply-To: <877bx0bptj.fsf@HIDDEN>
References: <87plassyqb.fsf@HIDDEN> <877bx0bptj.fsf@HIDDEN>
Date: Tue, 14 Oct 2025 14:01:52 -0600
Message-ID: <87ecr58d73.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 79616
Cc: 79616 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--=-=-=
Content-Type: text/plain

Juri Linkov <juri@HIDDEN> writes:

>> This patch ensure the indicators to update correctly after using
>> `hs-hide-all` or `hs-show-all`.
>> [...]
>> +        (if (memq (print this-command) '(hs-hide-all hs-show-all))
>> +            (hs--add-indicators (point-min) (point-max))
>
> For example, in my config I added a DWIM command
> that dispatches to `hs-hide-all` and `hs-show-all`
> depending on the prefix argument:
>
> #+begin_src emacs-lisp
> (defun my-hs-toggle-hiding (&optional arg)
>   (interactive "P")
>   (cond
>    ((eq arg 0) (if (seq-some (lambda (ov) (overlay-get ov 'hs))
>                              (overlays-in (point-min) (point-max)))
>                    (hs-show-all)
>                  (hs-hide-all)))
>    (arg (hs-hide-level arg))
>    (t (hs-toggle-hiding))))
>
> (keymap-set hs-minor-mode-map "s--" #'my-hs-toggle-hiding)
> #+end_src
>
> And other users might do something similar.  Then such
> commands will not be handled in `hs--refresh-indicators`.
>
> Maybe better to use some dynamically bound variable
> to detect corresponding calls?

Probably this should be done in the hs primitive functions, so this
should avoid excessive calls to `hs--refresh-indicators` and improve
compatibility with all the commands.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-hideshow-Update-the-indicators-properly-after-showin.patch

From fdea858254ad987ab59adc51d60b54fd6a61e54d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN>
Date: Sat, 11 Oct 2025 19:10:11 -0600
Subject: [PATCH] hideshow: Update the indicators properly after
 showing/hidding

bug#79616

* lisp/progmodes/hideshow.el (hs-discard-overlays)
(hs-make-overlay, hs-hide-block, hs-show-block): Rework
'hs--refresh-indicators' calls.
(hs--refresh-indicators): Rework code, add new function
arguments.
(hs-minor-mode): Properly remove the indicators after turning
off the mode.
---
 lisp/progmodes/hideshow.el | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index d01f855a7f8..6f8a655e3e3 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -620,7 +620,8 @@ hs-discard-overlays
             (delete-overlay ov))))
     (dolist (ov (overlays-in from to))
       (when (overlay-get ov 'hs)
-        (delete-overlay ov)))))
+        (delete-overlay ov))))
+  (hs--refresh-indicators from to))
 
 (defun hs-hideable-region-p (beg end)
   "Return t if region in BEG and END can be hidden."
@@ -666,6 +667,7 @@ hs-make-overlay
       (overlay-put ov 'isearch-open-invisible-temporary
                    'hs-isearch-show-temporary))
     (when hs-set-up-overlay (funcall hs-set-up-overlay ov))
+    (hs--refresh-indicators b e)
     ov))
 
 (defun hs-block-positions ()
@@ -771,14 +773,12 @@ hs--add-indicators
     (forward-line 1))
   `(jit-lock-bounds ,beg . ,end))
 
-(defun hs--refresh-indicators ()
-  "Update indicators appearance at current block."
-  (when hs-show-indicators
+(defun hs--refresh-indicators (from to)
+  "Update indicators appearance in FROM and TO."
+  (when (and hs-show-indicators hs-minor-mode)
     (save-match-data
       (save-excursion
-        ;; Using window-start and window-end is more faster
-        ;; than computing again the block positions
-        (hs--add-indicators (window-start) (window-end))))))
+        (hs--add-indicators from to)))))
 
 (defun hs--get-ellipsis (b e)
   "Helper function for `hs-make-overlay'.
@@ -1181,7 +1181,6 @@ hs-hide-block
 	   (funcall hs-looking-at-block-start-p-func)
            (funcall hs-find-block-beginning-func))
        (hs-hide-block-at-point end c-reg)
-       (hs--refresh-indicators)
        (run-hooks 'hs-hide-hook))))))
 
 (defun hs-show-block (&optional end)
@@ -1192,6 +1191,7 @@ hs-show-block
   (interactive "P")
   (hs-life-goes-on
    (or
+    ;; FIXME: Should this be in `hs-discard-overlays'?
     ;; first see if we have something at the end of the line
     (let ((ov (hs-overlay-at (line-end-position)))
           (here (point)))
@@ -1201,6 +1201,7 @@ hs-show-block
                ((eq 'comment (overlay-get ov 'hs)) here)
                (t (+ (overlay-start ov) (overlay-get ov 'hs-b-offset)))))
         (delete-overlay ov)
+        (hs--refresh-indicators (overlay-start ov) (overlay-end ov))
         t))
     ;; not immediately obvious, look for a suitable block
     (let ((c-reg (hs-inside-comment-p))
@@ -1217,7 +1218,6 @@ hs-show-block
       (when (and p q)
         (hs-discard-overlays p q)
         (goto-char (if end q (1+ p))))))
-   (hs--refresh-indicators)
    (run-hooks 'hs-show-hook)))
 
 (defun hs-hide-level (arg)
@@ -1320,12 +1320,12 @@ hs-minor-mode
           (jit-lock-register #'hs--add-indicators)))
 
     (remove-from-invisibility-spec '(hs . t))
-    (when hs-show-indicators
-      (jit-lock-unregister #'hs--add-indicators)
-      (remove-overlays nil nil 'hs-indicator t))
     ;; hs-show-all does nothing unless h-m-m is non-nil.
     (let ((hs-minor-mode t))
-      (hs-show-all))))
+      (hs-show-all))
+    (when hs-show-indicators
+      (jit-lock-unregister #'hs--add-indicators)
+      (remove-overlays nil nil 'hs-indicator t))))
 
 ;;;###autoload
 (defun turn-off-hideshow ()
-- 
2.51.0


--=-=-=
Content-Type: text/plain


-- 
- E.G via Gnus and Org.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79616; Package emacs. Full text available.

Message received at 79616 <at> debbugs.gnu.org:


Received: (at 79616) by debbugs.gnu.org; 12 Oct 2025 06:35:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 12 02:35:32 2025
Received: from localhost ([127.0.0.1]:47567 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v7pg4-0005sz-2T
	for submit <at> debbugs.gnu.org; Sun, 12 Oct 2025 02:35:32 -0400
Received: from mout-p-103.mailbox.org ([2001:67c:2050:0:465::103]:60368)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1v7pg0-0005sh-VU
 for 79616 <at> debbugs.gnu.org; Sun, 12 Oct 2025 02:35:30 -0400
Received: from smtp2.mailbox.org (smtp2.mailbox.org
 [IPv6:2001:67c:2050:b231:465::2])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4ckrMC12Pgz9svD;
 Sun, 12 Oct 2025 08:35:19 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1760250919;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=rhbtW+Ynz8Z5/cDS8dbFDJvqDNcLW058WDtIWbN8T8w=;
 b=HmhFsmpY7p7nhH79L6Vjq6aMn1Nx0TaX68+P3UZ6C6i+JveXziO4mgoOwCcSrSb2RlFvpg
 k5Qd1rFkhS+fF7954VieRafxTSZ+BzJ4DBuQ5lHKmFNngWmxs8plMvdCHd6TF0M7WhQkdd
 jkASkyamxjOiOvxk7U1yj08nCj8vNFllwhkvbjf0aCnnQ9E9mmRcPVf1PpCM6wrj+B7OpZ
 djdgYYa3LisPTxs71NmTtNKvGC/bqHzSDz0YcipItkpKHPs4n81qNVAwx6dk07Et+fOBw0
 /j6DCTU1qZ+sSfo57CBjPS5U1Oci1Amu9flguPplVQFnaaWUHjEq5PdjUwgBoA==
Authentication-Results: outgoing_mbo_mout; dkim=none;
 spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
 2001:67c:2050:b231:465::2 as permitted sender) smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= <eg642616@HIDDEN>
Subject: Re: bug#79616: [PATCH] hideshow: Update the indicators properly
 after using hs-hide/show-all commands
In-Reply-To: <87plassyqb.fsf@HIDDEN>
Organization: LINKOV.NET
References: <87plassyqb.fsf@HIDDEN>
Date: Sun, 12 Oct 2025 09:24:08 +0300
Message-ID: <877bx0bptj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4ckrMC12Pgz9svD
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79616
Cc: 79616 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> This patch ensure the indicators to update correctly after using
> `hs-hide-all` or `hs-show-all`.
> [...]
> +        (if (memq (print this-command) '(hs-hide-all hs-show-all))
> +            (hs--add-indicators (point-min) (point-max))

For example, in my config I added a DWIM command
that dispatches to `hs-hide-all` and `hs-show-all`
depending on the prefix argument:

#+begin_src emacs-lisp
(defun my-hs-toggle-hiding (&optional arg)
  (interactive "P")
  (cond
   ((eq arg 0) (if (seq-some (lambda (ov) (overlay-get ov 'hs))
                             (overlays-in (point-min) (point-max)))
                   (hs-show-all)
                 (hs-hide-all)))
   (arg (hs-hide-level arg))
   (t (hs-toggle-hiding))))

(keymap-set hs-minor-mode-map "s--" #'my-hs-toggle-hiding)
#+end_src

And other users might do something similar.  Then such
commands will not be handled in `hs--refresh-indicators`.

Maybe better to use some dynamically bound variable
to detect corresponding calls?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79616; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Oct 2025 01:19:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 11 21:19:56 2025
Received: from localhost ([127.0.0.1]:47233 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1v7kke-0008Ie-9H
	for submit <at> debbugs.gnu.org; Sat, 11 Oct 2025 21:19:56 -0400
Received: from lists.gnu.org ([2001:470:142::17]:49038)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1v7kkc-0008IQ-3G
 for submit <at> debbugs.gnu.org; Sat, 11 Oct 2025 21:19:54 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eg642616@HIDDEN>)
 id 1v7kkW-0003qr-8E
 for bug-gnu-emacs@HIDDEN; Sat, 11 Oct 2025 21:19:48 -0400
Received: from mail-oo1-xc44.google.com ([2607:f8b0:4864:20::c44])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <eg642616@HIDDEN>)
 id 1v7kkT-0004X4-HJ
 for bug-gnu-emacs@HIDDEN; Sat, 11 Oct 2025 21:19:48 -0400
Received: by mail-oo1-xc44.google.com with SMTP id
 006d021491bc7-6502c451e4dso87682eaf.3
 for <bug-gnu-emacs@HIDDEN>; Sat, 11 Oct 2025 18:19:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1760231983; x=1760836783; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=rhsFM092QAFhuq2Igff6y/UBOc4DQmME9e5/Jk0LqBE=;
 b=KstmAewq/pq7ANFXLhu2/1rK2eiRMNnTpVC2TZmHezWERGZMpXeAnEM9gQNP6Wtwvv
 7MTBlEouH+ZYyMoj9DULKqhdvOwT45D/Drn3/ve+NrM+P1bqtMH8x9jgEL8zCEyFyHtC
 ujNHjeYqQ4sn+d/7et/1vkl/jHzf9z5it1dan/+DcFlRAEPkTZadpeyBiSl3+mSxTqlR
 6uTKXnfbeL+8MppIMiBUIYiJSWyhGVEQXiI+C62i1OvjpMcUVcdmg07NERkKCSIdDKva
 qs1llv/CqZVPUBkvmqYhYaeLft8sU8zK1oe3mP1fUkiWSPmjNHoKNkPGhjUDiSdxNZrh
 G4xA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1760231983; x=1760836783;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=rhsFM092QAFhuq2Igff6y/UBOc4DQmME9e5/Jk0LqBE=;
 b=dGd6DVgEdHcmPIIf6/DJVAIjcgqFHa2rk6502sPmNtAcILRkGpeh8znYftfTAMyTbi
 uJ3NHN6Kyyoq8iPpI+r4/qQy3CWWjoj+2kfiR6AbxEkdTbii+gIsSdprvTR/6Ga+TBE0
 yGyk741tuv3eH1pD/ap2YpRQ48tToAnBKl5XSWz7cOHx3PiLYgkFZYhDqwoDd/4gwVdI
 XhSC0S4tsTLxkZkb1/CdvHeukcyOrjSLzBZbtjKEGb1pX8PJr9O1X5+wf3FyUQ/qFM7e
 oNJIoxlgr2jnG/yPmdNyCAGWEIwnF87rRDq524RVTS7Ezp21uk+pBMplkcx6F44D1w0Y
 wYaw==
X-Gm-Message-State: AOJu0YzBC/yzyWCBN/Eve0tdVoeR4Xo8wVC/EO8aojnPJ/7M1K9lLDu+
 EaNRxuWosdBFk+P6NNaz7kQBjumhkY26JtnK63168sFDhpROhE3qOb2ldks21S5J
X-Gm-Gg: ASbGncvTlJfwiz7yIJq6uPj4eZiLyhhFETwYEKMfUiZOTbi3JjlvtWSThVcuiqUBChR
 kZfTHJYKMuI2r6Xu6hBd4PSr/Wbf/eQmmGbvtcCCPZSK5n2iVSQEiGGfswcPYBbIK91TU2kJXIn
 QOjWZhLlwVgj1Z31CI3zSw/HuKjO5v6tAt62SuT4uoL2MqMD7VQQG6l/iZa+2NLeahY1AMhnB0F
 Ft3kW+cnioLFWwmWWBsyfwwz/7BV88zLB7oGnDdW+XMZkBXrtyEz5Nine6yK7f/rx8QynsO2QQg
 graAmcLh4oL5kyhsW6pr9/r5Dyz+P4QYNm1gVvKW3k7Y8rcVlJCR5He3sCNU3sZITF/qXnj1BVR
 tjQhBdnTkoYM7LLCQQH0hv4uHf3xCZ+J1uqXbwIruE6kgIg==
X-Google-Smtp-Source: AGHT+IGOLqg72mo1ZUeKl73PwehdB+DH2PeAXp9cC/KyxEwI0N3kIvQ650xBQjZ27LcY/BXtjA8v+A==
X-Received: by 2002:a05:6870:322d:b0:332:8147:25b3 with SMTP id
 586e51a60fabf-3c0fa95b792mr8884974fac.47.1760231983492; 
 Sat, 11 Oct 2025 18:19:43 -0700 (PDT)
Received: from fedora ([189.215.165.229]) by smtp.gmail.com with ESMTPSA id
 586e51a60fabf-3c8c8e81981sm2229074fac.16.2025.10.11.18.19.41
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 11 Oct 2025 18:19:42 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] hideshow: Update the indicators properly after using
 hs-hide/show-all commands
Date: Sat, 11 Oct 2025 19:19:40 -0600
Message-ID: <87plassyqb.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::c44;
 envelope-from=eg642616@HIDDEN; helo=mail-oo1-xc44.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: Tags: patch This patch ensure the indicators to update
 correctly after using `hs-hide-all` or `hs-show-all`. From
 bd3559972ee65e321dc027e87321872dc417118e
 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?=
 Date: Sat, 11 Oct 2025 19:10:11 -0600 Subject: [PATCH] hideshow: Update the
 [...] Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
 in digit (eg642616[at]gmail.com)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (eg642616[at]gmail.com)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

--=-=-=
Content-Type: text/plain

Tags: patch


This patch ensure the indicators to update correctly after using
`hs-hide-all` or `hs-show-all`.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-hideshow-Update-the-indicators-properly-after-using-.patch

From bd3559972ee65e321dc027e87321872dc417118e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN>
Date: Sat, 11 Oct 2025 19:10:11 -0600
Subject: [PATCH] hideshow: Update the indicators properly after using
 hs-hide/show-all commands

bug#

* lisp/progmodes/hideshow.el (hs--refresh-indicators): Use
'point-min' and 'point-max' only when hs-hide-all or hs-show-all
commands are being executed.
(hs-hide-block, hs-show-block): Remove 'hs--refresh-indicators'
call.
(hs-minor-mode): Add 'hs--refresh-indicators' to 'hs-hide-hook'
and 'hs-show-hook'.
---
 lisp/progmodes/hideshow.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index d01f855a7f8..e86e09e375a 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -776,9 +776,11 @@ hs--refresh-indicators
   (when hs-show-indicators
     (save-match-data
       (save-excursion
-        ;; Using window-start and window-end is more faster
-        ;; than computing again the block positions
-        (hs--add-indicators (window-start) (window-end))))))
+        (if (memq (print this-command) '(hs-hide-all hs-show-all))
+            (hs--add-indicators (point-min) (point-max))
+          ;; Using window-start and window-end is more faster
+          ;; than computing again the block positions
+          (hs--add-indicators (window-start) (window-end)))))))
 
 (defun hs--get-ellipsis (b e)
   "Helper function for `hs-make-overlay'.
@@ -1181,7 +1183,6 @@ hs-hide-block
 	   (funcall hs-looking-at-block-start-p-func)
            (funcall hs-find-block-beginning-func))
        (hs-hide-block-at-point end c-reg)
-       (hs--refresh-indicators)
        (run-hooks 'hs-hide-hook))))))
 
 (defun hs-show-block (&optional end)
@@ -1217,7 +1218,6 @@ hs-show-block
       (when (and p q)
         (hs-discard-overlays p q)
         (goto-char (if end q (1+ p))))))
-   (hs--refresh-indicators)
    (run-hooks 'hs-show-hook)))
 
 (defun hs-hide-level (arg)
@@ -1317,6 +1317,8 @@ hs-minor-mode
           (when (and (not (display-graphic-p))
                      (eq hs-indicator-type 'fringe))
             (setq-local hs-indicator-type 'margin))
+          (add-hook 'hs-hide-hook #'hs--refresh-indicators nil :local)
+          (add-hook 'hs-show-hook #'hs--refresh-indicators nil :local)
           (jit-lock-register #'hs--add-indicators)))
 
     (remove-from-invisibility-spec '(hs . t))
-- 
2.51.0


--=-=-=
Content-Type: text/plain


-- 
- E.G via Gnus and Org.

--=-=-=--




Acknowledgement sent to Elijah Gabe Pérez <eg642616@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#79616; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 21 Oct 2025 06:45:01 UTC

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