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#73018: 31.0.50; wdired + replace-regexp only modifies the visible portion of the buffer Date: Tue, 10 Sep 2024 09:21:46 -0400 Message-ID: References: <20240904.080321.1100373523429404965.enometh@meer.net> <87seug85hh.fsf@web.de> <86y147gzx0.fsf@mail.linkov.net> <874j6uz4d8.fsf@web.de> <86ed5yujq3.fsf@mail.linkov.net> <87v7z9rnrp.fsf@web.de> <87o750dats.fsf@web.de> <868qw2ruv3.fsf@mail.linkov.net> <87bk0w511c.fsf@web.de> <86a5gg7nrs.fsf@mail.linkov.net> <86tteo3wmh.fsf@mail.linkov.net> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14320"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Michael Heerdegen , Madhu , 73018@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 10 15:23:14 2024 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 1so0pt-0003Tv-E9 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Sep 2024 15:23:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so0pf-0006eE-Ca; Tue, 10 Sep 2024 09:22: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 1so0pd-0006Ol-FG for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2024 09:22: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 1so0pd-0001jH-5T for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2024 09:22:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=qZNolnFKhSJFICBGOKpV8xwWnWLAkxqL35lLI/O1JVk=; b=dupNAtd6fbPZsH36oWVpLy2/CL/9mC7EmWcsHgE7XpuZQhk0BohihjtCBwzPQsJv09PwgXpsJIMCAOIozaKQx3U2hTeHh53piWfF5tUy8YBA4KsAJe+0RQH/nlJeO50CxiuTiXCaDYM/EeW15zEDOAqRSfP1ZSRgOyRMBHDoqFQOISAHZhBLXedOV7IFaZdev5k3uM8Pd6135ceWjAg47pkmenA7z8lqub17UvC6elgN8HSiI6/BSihn0WGeQyxLVXvMsUZLPNUgSaDxbPYQG/9cqZwSTgaf7AFW7J/drCE/0qKt/F5U8Og8N+iqotc52WTs8Tz7QNoPc7q7Op/Nag==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1so0pi-0003Ah-3k for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2024 09:23: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: Tue, 10 Sep 2024 13:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73018 X-GNU-PR-Package: emacs Original-Received: via spool by 73018-submit@debbugs.gnu.org id=B73018.172597452912125 (code B ref 73018); Tue, 10 Sep 2024 13:23:02 +0000 Original-Received: (at 73018) by debbugs.gnu.org; 10 Sep 2024 13:22:09 +0000 Original-Received: from localhost ([127.0.0.1]:35061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1so0oq-00039U-V6 for submit@debbugs.gnu.org; Tue, 10 Sep 2024 09:22:09 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:52097) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1so0op-000390-9b for 73018@debbugs.gnu.org; Tue, 10 Sep 2024 09:22:08 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6364144125A; Tue, 10 Sep 2024 09:21:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1725974513; bh=5pncrJe/pNqGJIJwmS5t0GAO1io/42LCsJkVzRHchB8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=LXu93oK88SHbVLXGrHoyJITWVvBYg/oOffdfVwC16eHR9vjYi4AaRemOBYvjDeGss 0QLksSy6T440e+ttMfCvuyV+444UJ5aSSryYIE5U6d9WW9mQBffnads5Kb08PY0Mf/ VFMX4PwoEuKwJDtOv7obnI7WGyGObBVCB4CY+zJYA5wwFj8BsJ+O8Fjr2zhYTnF2Nl 7uPNKptT0k9qOSiTC+U2NUYOT2aFbUV47+LkfTyZ01cn/hlxkqVm3JMEOny+x1atOC YDuRKSiutXf+1bazQoyGzDgg9jWTmP10RTfrenFePvfetNQMWOF/K9fc9s8/RKJwA2 HPX+R9zEUOrJg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C13F04412A5; Tue, 10 Sep 2024 09:21:53 -0400 (EDT) Original-Received: from pastel (104-195-217-100.cpe.teksavvy.com [104.195.217.100]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 92F83120183; Tue, 10 Sep 2024 09:21:53 -0400 (EDT) In-Reply-To: <86tteo3wmh.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 10 Sep 2024 09:28:50 +0300") 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:291562 Archived-At: > This is caused by commit 63588775fcb, so Cc-ing Stefan. > > But probably this commit just exposed the problem > that existed before? I think you're on to something. > => (error "Match data clobbered by buffer modification hooks") This comes from if (search_regs.num_regs != num_regs) error ("Match data clobbered by buffer modification hooks"); But this test is not doing what it is intended to do: it doesn't check whether the match data has changed. It just checks whether the size of the arrays we have allocated to hold the match data has changed. I got to that conclusion after narrowing down the origin of the error and finding out that the problem is that `search_regs.num_regs` is set to 13 before the first call to `wdired--restore-properties` but to 23 afterwards. We should probably use something like ptrdiff_t search_regs_last_reg (void) { ptrdiff_t i = search_regs.num_regs - 1; while (i >= 0 && search_regs.start[i] < 0) i--; return i; } instead of `search_regs.num_regs`. Stefan