GNU bug report logs - #79865
[PATCH] hideshow: Add modification hooks to remove the hidden blocks

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 79865 <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 79865 <at> debbugs.gnu.org:


Received: (at 79865) by debbugs.gnu.org; 20 Nov 2025 17:43:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 20 12:43:16 2025
Received: from localhost ([127.0.0.1]:49557 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vM8ge-00069D-4e
	for submit <at> debbugs.gnu.org; Thu, 20 Nov 2025 12:43:16 -0500
Received: from mout-p-102.mailbox.org ([2001:67c:2050:0:465::102]:52232)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1vM8gb-00068V-VW; Thu, 20 Nov 2025 12:43:15 -0500
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-102.mailbox.org (Postfix) with ESMTPS id 4dC5Kj3Q9Qz9tMX;
 Thu, 20 Nov 2025 18:43:05 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1763660585;
 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=CNRpUIvJzHvw2lUuJABaHo2qtmsY9V93dIcITXImcXM=;
 b=BCpVKJBXpD+Fiy+sem4ziZg7jfAnLS9xRfPCxGi/QEamfXmWWP489aACbCk93+C7XhEvAY
 byx11pMore02W9FOBlHFyBjrZIXy603o3asAnMZ9ChD4/YFwpWg21P5P5LxupE3jDt/3Gy
 DQlEBmmfrG50iqBz7E5RsuNEWp91CCM5yMj0Otk4D08V1GHH8ijLbcezlDZXqCO+slhRg4
 F80D03srJpkqU8QfIs0qr4Qha7ZdhY2cgkYWsV93dXpVJYgeT15lpLbBpoNZ5NOPdCswxQ
 1/CA2B1p26hSkIj65J97vYx9rJvjquBi5pFHQo3H2p0izEgwK6v7leQuNwl5Cg==
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#79865: [PATCH] hideshow: Add modification hooks to remove
 the hidden blocks
In-Reply-To: <87ldk1scp9.fsf@HIDDEN>
Organization: LINKOV.NET
References: <87ldk1scp9.fsf@HIDDEN>
Date: Thu, 20 Nov 2025 19:42:22 +0200
Message-ID: <87zf8gha81.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4dC5Kj3Q9Qz9tMX
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 79865
Cc: 79865 <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.0 (-)

close 79865 31.0.50
thanks

> This patch adds the `modification-hooks`, `insert-in-front-hooks` and
> `insert-behind-hooks` hooks to the overlay ellipsis, so any modification
> near the ellipsis (or inside the hidden block) should show the hidden
> block.

Thanks, pushed.




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

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


Received: (at submit) by debbugs.gnu.org; 20 Nov 2025 01:41:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 19 20:41:21 2025
Received: from localhost ([127.0.0.1]:42573 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vLtfk-0007XM-Pr
	for submit <at> debbugs.gnu.org; Wed, 19 Nov 2025 20:41:21 -0500
Received: from lists.gnu.org ([2001:470:142::17]:42058)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1vLtfi-0007Wt-V2
 for submit <at> debbugs.gnu.org; Wed, 19 Nov 2025 20:41:19 -0500
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 1vLtfc-0005M4-Pv
 for bug-gnu-emacs@HIDDEN; Wed, 19 Nov 2025 20:41:12 -0500
Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <eg642616@HIDDEN>)
 id 1vLtfb-0003c0-8e
 for bug-gnu-emacs@HIDDEN; Wed, 19 Nov 2025 20:41:12 -0500
Received: by mail-oi1-x243.google.com with SMTP id
 5614622812f47-45074d0010aso94466b6e.0
 for <bug-gnu-emacs@HIDDEN>; Wed, 19 Nov 2025 17:41:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1763602869; x=1764207669; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=7r4u/PQbbN8srJd+SK/F2QfTKhNrgDuaVE/k4DjM12s=;
 b=YQ13SFisowJqHNKbrtI+8IfmkE98CToKs6sIdq5aS09zOd9knQA+Hl1YCldQDBxYfR
 C8XcSUY22GxI9VRBRdIqLENxa9DO+WZOy/LevrjHWJTMN2CpVJ3SNX1Wyaruhl/6TKkG
 aCXYqsIrsIzzeZw3GE60+HhXTDZlTrh0ttdPciY6NPpK6kCqsV85F6R1qm6uZ2bV4o3Z
 NgLYZdCPUxyPlOPV6weEoV6NbYq5naSmQ+aBRuxwqewm/+dgjQjDzS25g2P89miMOJmg
 R7Wjy+2xiMDTVoI/7FkOqfWTVtyY+I1QC86pnAoo5IDekpp6ldMg7T8zUahZ1qG1sLHT
 2BKQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1763602869; x=1764207669;
 h=mime-version:message-id:date:subject:to:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=7r4u/PQbbN8srJd+SK/F2Q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n1hrZFgtNV2+I0t4vC3xfXDBIMmcmSw==
X-Received: by 2002:a05:6808:1492:b0:450:3823:b607 with SMTP id
 5614622812f47-451002d5effmr556541b6e.59.1763602868968; 
 Wed, 19 Nov 2025 17:41:08 -0800 (PST)
Received: from fedora ([189.215.165.71]) by smtp.gmail.com with ESMTPSA id
 586e51a60fabf-3ec9dcfe28csm514451fac.22.2025.11.19.17.41.07
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 19 Nov 2025 17:41:08 -0800 (PST)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] hideshow: Add modification hooks to remove the hidden blocks
Date: Wed, 19 Nov 2025 19:41:06 -0600
Message-ID: <87ldk1scp9.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::243;
 envelope-from=eg642616@HIDDEN; helo=mail-oi1-x243.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 adds the `modification-hooks`,
 `insert-in-front-hooks`
 and `insert-behind-hooks` hooks to the overlay ellipsis, so any modification
 near the ellipsis (or inside the hidden block) should sho [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
 in digit (eg642616[at]gmail.com)
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (eg642616[at]gmail.com)
 -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]
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 adds the `modification-hooks`, `insert-in-front-hooks` and
`insert-behind-hooks` hooks to the overlay ellipsis, so any modification
near the ellipsis (or inside the hidden block) should show the hidden
block.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-hideshow-Add-modification-hooks-to-remove-the-hidden.patch

From 9c39bd4e30505aff07256611bc311d499a05b817 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN>
Date: Mon, 17 Nov 2025 21:17:46 -0600
Subject: [PATCH] hideshow: Add modification hooks to remove the hidden blocks

bug#

* lisp/progmodes/hideshow.el (hs--discard-overlay-after-change):
New function.
(hs-make-overlay): Use the new function.
---
 lisp/progmodes/hideshow.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index 78990993449..9474332e269 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -752,6 +752,15 @@ hs-hideable-region-p
     (when-let* ((block (hs-block-positions)))
       (apply #'hs-hideable-region-p block))))
 
+(defun hs--discard-overlay-after-change (o &rest _r)
+  "Remove overlay O after changes.
+Intended to be used in `modification-hooks', `insert-in-front-hooks' and
+`insert-behind-hooks'."
+  (let ((beg (overlay-start o))
+        (end (overlay-end o)))
+    (delete-overlay o)
+    (hs--refresh-indicators beg end)))
+
 (defun hs-make-overlay (b e kind &optional b-offset e-offset)
   "Return a new overlay in region defined by B and E with type KIND.
 KIND is either `code' or `comment'.  Optional fourth arg B-OFFSET
@@ -778,13 +787,20 @@ hs-make-overlay
                   'highlight
                   'help-echo "mouse-1: show hidden lines"
                   'keymap '(keymap (mouse-1 . hs-toggle-hiding))))
+    ;; Internal properties
     (overlay-put ov 'hs kind)
     (overlay-put ov 'hs-b-offset b-offset)
     (overlay-put ov 'hs-e-offset e-offset)
+    ;; Isearch integration
     (when (or (eq io t) (eq io kind))
       (overlay-put ov 'isearch-open-invisible 'hs-isearch-show)
       (overlay-put ov 'isearch-open-invisible-temporary
                    'hs-isearch-show-temporary))
+    ;; Remove overlay after modifications
+    (overlay-put ov 'modification-hooks    '(hs--discard-overlay-after-change))
+    (overlay-put ov 'insert-in-front-hooks '(hs--discard-overlay-after-change))
+    (overlay-put ov 'insert-behind-hooks   '(hs--discard-overlay-after-change))
+
     (when hs-set-up-overlay (funcall hs-set-up-overlay ov))
     (hs--refresh-indicators b e)
     ov))
-- 
2.51.1


--=-=-=
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#79865; 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: Thu, 20 Nov 2025 17:45:01 UTC

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