GNU bug report logs - #67124
26.3; query-replace Arg out of range with comma option (at end-buffer)

Previous Next

Package: emacs;

Reported by: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>

Date: Sun, 12 Nov 2023 07:52:03 UTC

Severity: normal

Merged with 67050

Found in version 26.3

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

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: gabriele <at> medialab.sissa.it, 67124 <at> debbugs.gnu.org
Subject: Re: bug#67124: 26.3; query-replace Arg out of range with comma
 option (at end-buffer)
Date: Thu, 16 Nov 2023 20:34:59 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: gabriele <at> medialab.sissa.it,  67124 <at> debbugs.gnu.org
> Date: Thu, 16 Nov 2023 13:01:27 -0500
> 
> >> > What are you trying to understand?
> >> 
> >> Why you're saying that in
> >> 
> >>     ;; `replace-match' leaves point at the end of the replacement text,
> >>     ;; so move point to the beginning when replacing backward.
> >>     (when backward (goto-char (nth 0 match-data)))
> >> 
> >> it is not true that
> >> 
> >>     and (nth 0 match-data) == (match-beginning 0), no?
> >
> > Because of markers vs positions, as I've tried to explain.  The
> > difference is minor, of course.
> 
> But `goto-char` doesn't care about that difference, and no buffer will
> be changed between the time we call `match-data` (thus creating the
> markers) and the time we use those markers, so going through markers is
> just extra work for no benefit.
> 
> IOW, I still don't understand how "markers vs positions" is relevant in
> 
>     (when backward (goto-char (nth 0 match-data)))
> 
> >> > What my kludge did is simply use a marker, so the adjusted position is
> >> > not clobbered.
> >> 
> >> I don't see that.  E.g. if you change your code from
> >> 
> >>     (set-match-data (list (car match-data) (nth 1 (match-data))))
> >> to
> >>     (set-match-data (list (car match-data) (nth 1 (match-data t))))
> >> 
> >> it fixes the problem just as well, AFAICT.
> >
> > Yes, but match-data (the function) returns updated positions, which
> > behave like markers across the replace-match call.
> 
> But the positions have already been updated.  So
> 
>     (match-data t)
> 
> would also return those updated positions, even though it doesn't
> use markers.

We are both saying the same things, just past each other.  There's no
disagreement or argument here between us.




This bug report was last modified 1 year and 187 days ago.

Previous Next


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