[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67124: 26.3; query-replace Arg out of range with comma option (at en
From: |
Stefan Monnier |
Subject: |
bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer) |
Date: |
Thu, 16 Nov 2023 13:01:27 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> > 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.
Stefan
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Gabriele Nicolardi, 2023/11/12
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Eli Zaretskii, 2023/11/12
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Stefan Monnier, 2023/11/12
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Eli Zaretskii, 2023/11/13
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Stefan Monnier, 2023/11/16
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Eli Zaretskii, 2023/11/16
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Stefan Monnier, 2023/11/16
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Eli Zaretskii, 2023/11/16
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer),
Stefan Monnier <=
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Eli Zaretskii, 2023/11/16
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Stefan Monnier, 2023/11/16
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Eli Zaretskii, 2023/11/16
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Stefan Monnier, 2023/11/16
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Eli Zaretskii, 2023/11/18
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Stefan Monnier, 2023/11/18
- bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer), Stefan Monnier, 2023/11/18
Message not available