all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: michael_heerdegen@web.de, enometh@meer.net,
	73018@debbugs.gnu.org, juri@linkov.net
Subject: bug#73018: 31.0.50; wdired + replace-regexp only modifies the visible portion of the buffer
Date: Sun, 15 Sep 2024 09:04:40 -0400	[thread overview]
Message-ID: <jwv34m1f4w8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <86h6aih8i9.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Sep 2024 12:47:26 +0300")

>> > 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`.
>> 
>> And maybe we should consider changing `struct re_search` to keep track
>> of the last non-nil subgroup.  Currently, things like `match-data` loop
>> through all the elements of `search_regs` whose size depends on the
>> size (in number of subgroups) of the largest regexp we have ever matched
>> so far, rather than the actual number of subgroups currently in use, so
>> there's some wasted work there.  Maybe the cost of maintaining the "last
>> reg" would pay off.
>
> Since this is a regression in Emacs 30, I'd like to solve it on the
> release branch.  Can you suggest the safest fix you can come up with
> for that purpose?

Oh, yes: just remove the check.  Since `search_regs.num_regs` keeps
track only of the size of the array (rather than the part of it
currently in use), and the array is never shrunk, it changes *very* few
times in an Emacs session, so this check we have triggers
*extremely* rarely.

The "correct" change I suggest above would definitely not be good for
the release branch since it will likely catch more cases (and thus
introduce regressions where code used to "work" but now signals an
error).


        Stefan






  reply	other threads:[~2024-09-15 13:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04  2:33 bug#73018: 31.0.50; wdired + replace-regexp only modifies the visible portion of the buffer Madhu
2024-09-04  3:25 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04  8:58   ` Madhu
2024-09-04  9:08     ` Madhu
2024-09-04 16:13   ` Juri Linkov
2024-09-05 12:12     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 16:51       ` Madhu
2024-09-05 16:51       ` Juri Linkov
2024-09-06 12:04         ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 16:08           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 16:28             ` Juri Linkov
2024-09-09 14:55               ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 17:13                 ` Juri Linkov
2024-09-09 17:55                   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 17:14                 ` Juri Linkov
2024-09-10  6:28                   ` Juri Linkov
2024-09-10 13:21                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10 13:27                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-14  9:47                         ` Eli Zaretskii
2024-09-15 13:04                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-09-15 15:02                             ` Eli Zaretskii
2024-09-16  2:06                               ` Madhu
2024-09-16 14:24                                 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-17 18:57                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-17 18:52                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv34m1f4w8.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=73018@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=enometh@meer.net \
    --cc=juri@linkov.net \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.