From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: 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 Message-ID: <83il61pmwc.fsf@gnu.org> References: <020a72b2-b896-4ecf-abab-111a6c1c9eac@medialab.sissa.it> <83cywfuwta.fsf@gnu.org> <83pm0du49e.fsf@gnu.org> <83o7ftpx1w.fsf@gnu.org> <83jzqhprhb.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16004"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gabriele@medialab.sissa.it, 67124@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 16 19:36:31 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r3hE6-0003tt-OV for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Nov 2023 19:36:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3hDh-000819-NX; Thu, 16 Nov 2023 13:36:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r3hDf-00080p-Fw for bug-gnu-emacs@gnu.org; Thu, 16 Nov 2023 13:36:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3hDe-0004bw-MQ for bug-gnu-emacs@gnu.org; Thu, 16 Nov 2023 13:36:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r3hDe-0002bY-Dp for bug-gnu-emacs@gnu.org; Thu, 16 Nov 2023 13:36:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Nov 2023 18:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67124 X-GNU-PR-Package: emacs Original-Received: via spool by 67124-submit@debbugs.gnu.org id=B67124.17001597389966 (code B ref 67124); Thu, 16 Nov 2023 18:36:02 +0000 Original-Received: (at 67124) by debbugs.gnu.org; 16 Nov 2023 18:35:38 +0000 Original-Received: from localhost ([127.0.0.1]:44501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r3hDF-0002ag-MG for submit@debbugs.gnu.org; Thu, 16 Nov 2023 13:35:38 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r3hDC-0002aI-P6 for 67124@debbugs.gnu.org; Thu, 16 Nov 2023 13:35:35 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r3hD5-0004Tn-Sk; Thu, 16 Nov 2023 13:35:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=5DBBTnFJN1mECBgvPZp4a98at7i1/Thpsw7C5/JiRwk=; b=lvafridFze8r uFwBlJyzbOMlGvlbPr6cjVXHTxwieBNs8u2XTGF9+lFaBYombLdBkg20UD1c/1sN/4Aoevac4JWvg DtmINhsGsGm9eAMEtohO/gjiEYCmcsPXfHPHjOJki8fELMWggqM+13ivodt3ZwaR9Ed0TFA1O6GWa nNdFjN8H9KOGNPb3/HylW2CkLyMPu4JZpcMM6WJZaUtYoOWkIpFBEr/LMb67SqJvfW7acOwvoNRKQ syEtyxpGz7gszVkZu5XNS0y+H6NcaHpAQygE0kynNf1bVWsHaUlD5SDnKpbpSLRxY055BrTt1PsBc 7hE3OzMSTGhDj/nA1SQGVQ==; In-Reply-To: (message from Stefan Monnier on Thu, 16 Nov 2023 13:01:27 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274478 Archived-At: > From: Stefan Monnier > Cc: gabriele@medialab.sissa.it, 67124@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.