GNU bug report logs - #73018
31.0.50; wdired + replace-regexp only modifies the visible portion of the buffer

Previous Next

Package: emacs;

Reported by: Madhu <enometh <at> meer.net>

Date: Wed, 4 Sep 2024 02:38:01 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #53 received at 73018 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> linkov.net>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, Madhu <enometh <at> meer.net>,
 73018 <at> debbugs.gnu.org
Subject: Re: 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
> 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





This bug report was last modified 295 days ago.

Previous Next


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