From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65929: 29.1; modification-hooks run when deleting after the overlay Date: Wed, 13 Sep 2023 18:37:12 -0400 Message-ID: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3767"; mail-complaints-to="usenet@ciao.gmane.io" To: 65929@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 14 00:39:16 2023 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 1qgYVv-0000im-Ai for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Sep 2023 00:39:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qgYVf-0003sa-NX; Wed, 13 Sep 2023 18:38:59 -0400 Original-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 ) id 1qgYVd-0003sE-LB for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2023 18:38:57 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgYVd-0005n3-D2 for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2023 18:38:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qgYVi-0004xp-EM for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2023 18:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Sep 2023 22:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65929 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.169464473619065 (code B ref -1); Wed, 13 Sep 2023 22:39:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Sep 2023 22:38:56 +0000 Original-Received: from localhost ([127.0.0.1]:36290 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgYVb-0004xQ-AD for submit@debbugs.gnu.org; Wed, 13 Sep 2023 18:38:55 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:53186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgYVW-0004x7-IO for submit@debbugs.gnu.org; Wed, 13 Sep 2023 18:38:53 -0400 Original-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 ) id 1qgYVL-0003nw-8s for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2023 18:38:39 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgYVJ-0005j3-0D for bug-gnu-emacs@gnu.org; Wed, 13 Sep 2023 18:38:39 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id AEC451000E5 for ; Wed, 13 Sep 2023 18:38:35 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1694644709; bh=dYAvxKrGkPWRCWsD71xhDyppreHAdiOzM1NqAe7fVpw=; h=From:To:Subject:Date:From; b=VT2VB43ilrOQqgMF1pv1RDN7HMBrEX4gkVjihptXN1PA8Ys4Crl72/r5saSBX9HsO 4AZYrdFl8LsB3swSGA3TVRmQCZa/uvVHGUj3qUM+dCna66M+5NsVseNButbJoptJDZ 4qm4ildbbok7kIw9zLXgNdjVfBM/FhW5e6D7C/vMeOr9qvI1Iz4M1OOgKsaN7mwapS aXaWbh2xDijKStFka9aAw23ZmkLrxYFEPU7ZYYcBvRfKrUgxWxtH1rqvCFazIcLXee 6MctOcrBBrOjthI4QnWwCzl7AAQTuwsSeA/skgQPbYsD37n1L5BVhwe9l5X8RNk894 DjJFoZTUJlvYw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E98E41000A3 for ; Wed, 13 Sep 2023 18:38:29 -0400 (EDT) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D7E461202BE for ; Wed, 13 Sep 2023 18:38:29 -0400 (EDT) Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270373 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Package: Emacs Version: 29.1 As found via yasnippet's test suite, the new overlay code in Emacs-29 sometimes mistakenly runs the `modification-hooks` when the text *right after* an (empty) overlay is deleted. This can be seen in the attached trace obtained while running yasnippet's `delete-numberless-inner-snippet-issue-562` test. In that trace we see a call (yas--on-protection-overlay-modification # nil 1 5) i.e. a call where the `modification-hooks` function (`yas--on-protection-overlay-modification`) is called for a deletion of text between 1 and 5 while the overlay itself does not contain any of those characters since the overlay is empty, at BOB. According to the Texinfo doc: =E2=80=98modification-hooks=E2=80=99 This property=E2=80=99s value is a list of functions to be called = if any character within the overlay is changed or if text is inserted strictly within the overlay. The behavior in Emacs<29 obeys the Texinfo doc. Stefan --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=yasnippet-tests-trace.txt 1 -> (yas-skip-and-clear-field) | 2 -> (yas-current-field) | 2 <- yas-current-field: #1=#s(yas--field nil # # #s(yas--field 3 # # nil nil nil nil #1#) nil nil nil #s(yas--exit # #s(yas--field 2 # # nil nil nil nil nil))) | 2 -> (yas--skip-and-clear #1=#s(yas--field nil # # #s(yas--field 3 # # nil nil nil nil #1#) nil nil nil #s(yas--exit # #s(yas--field 2 # # nil nil nil nil nil)))) | | 3 -> (yas--mark-this-and-children-modified #1=#s(yas--field nil # # #s(yas--field 3 # # nil nil nil nil #1#) nil nil nil #s(yas--exit # #s(yas--field 2 # # nil nil nil nil nil)))) | | 3 <- yas--mark-this-and-children-modified: nil | | 3 -> (delete-region # #) | | | 4 -> (yas--on-field-overlay-modification # nil 1 5) | | | | 5 -> (yas-active-snippets 1 5) | | | | | 6 -> (overlays-in 1 12) | | | | | 6 <- overlays-in: (# # # #) | | | | | 6 -> (overlays-in 1 5) | | | | | 6 <- overlays-in: (# # #) | | | | 5 <- yas-active-snippets: (#s(yas--snippet nil (#2=#s(yas--field 2 # # nil nil nil nil nil) #1=#s(yas--field 3 # # nil nil nil nil #3=#s(yas--field nil # # #1# nil nil t #4=#s(yas--exit # #2#))) #3#) #4# 6 # #3# nil nil)) | | | 4 <- yas--on-field-overlay-modification: (#s(yas--snippet nil (#2=#s(yas--field 2 # # nil nil nil nil nil) #1=#s(yas--field 3 # # nil nil nil nil #3=#s(yas--field nil # # #1# nil nil t #4=#s(yas--exit # #2#))) #3#) #4# 6 # #3# nil nil)) | | | 4 -> (yas--on-protection-overlay-modification # nil 1 5) | | | 4 <- yas--on-protection-overlay-modification: nil | | | 4 -> (yas--on-field-overlay-modification # t 1 1 4) | | | | 5 -> (yas-active-snippets 1 1) | | | | | 6 -> (overlays-in 1 8) | | | | | 6 <- overlays-in: (# # # #) | | | | | 6 -> (overlays-in 1 1) | | | | | 6 <- overlays-in: (# #) | | | | 5 <- yas-active-snippets: (#s(yas--snippet nil (#2=#s(yas--field 2 # # nil nil nil nil nil) #1=#s(yas--field 3 # # nil nil nil nil #3=#s(yas--field nil # # #1# nil nil t #4=#s(yas--exit # #2#))) #3#) #4# 6 # #3# nil nil)) | | | 4 <- yas--on-field-overlay-modification: (#s(yas--snippet nil (#2=#s(yas--field 2 # # nil nil nil nil nil) #1=#s(yas--field 3 # # nil nil nil nil #3=#s(yas--field nil # # #1# nil nil t #4=#s(yas--exit # #2#))) #3#) #4# 6 # #3# nil nil)) | | | 4 -> (yas--on-protection-overlay-modification # t 1 1 4) | | | | 5 -> (yas-active-snippets) | | | | | 6 -> (overlays-in 1 8) | | | | | 6 <- overlays-in: (# # # #) | | | | | 6 -> (overlays-in 1 2) | | | | | 6 <- overlays-in: (# # # #) | | | | 5 <- yas-active-snippets: (#s(yas--snippet nil (#2=#s(yas--field 2 # # nil nil nil nil nil) #1=#s(yas--field 3 # # nil nil nil nil #3=#s(yas--field nil # # #1# nil nil t #4=#s(yas--exit # #2#))) #3#) #4# 6 # #3# nil nil)) | | | | 5 -> (yas--commit-snippet #s(yas--snippet nil (#2=#s(yas--field 2 # # nil nil nil nil nil) #1=#s(yas--field 3 # # nil nil nil nil #3=#s(yas--field nil # # #1# nil nil t #4=#s(yas--exit # #2#))) #3#) #4# 6 # #3# nil nil)) | | | | 5 <- yas--commit-snippet: nil | | | 4 <- yas--on-protection-overlay-modification: nil | | 3 <- delete-region: nil --=-=-=--