Subject: Re: bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer)
From: Eli Zaretskii <[email-masked]>
To: [email-masked]
Cc: [email-masked], [email-masked]
Date: Wed, 15 Nov 2023 15:18:25 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> Cc: [email-masked]
> Date: Sun, 12 Nov 2023 11:48:17 +0200
> From: Eli Zaretskii <[email-masked]>
> 
> > I often type `,` (`comma`) to check the replacement. It happens that, 
> > some times, I get the error (e.g.):
> > 
> > match-substitute-replacement: Args out of range: #<buffer *scratch*>, 
> > 1667, 1679
> > 
> > The error doesn't happen if I type `y` (or `n`)
> > 
> > Try this:
> > 
> > (query-replace ",.\\footnote{" ".\\footnote{" nil)
> > 
> > With the string ",.\footnote{" at the end of the buffer. To see the 
> > error "{" must be the last char in the buffer.
> > 
> > (I see often this bug because I use "narrowing" a lot)
> > 
> > Is it a known bug?
> 
> The kludgey solution in the patch below should fix this.  Please see
> if it indeed fixes your real-life use cases.

I've now installed this on master, and I'm closing this bug.