From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#54733: Match again in perform-replace Date: Fri, 24 Jun 2022 20:25:05 +0300 Organization: LINKOV.NET Message-ID: <86bkuiotxq.fsf@mail.linkov.net> References: <865ynnl9f0.fsf_-_@mail.linkov.net> <86pmlvju2c.fsf@mail.linkov.net> <86o80ju6qx.fsf@mail.linkov.net> <861qxb6qvh.fsf@mail.linkov.net> <9d54db84-77ba-6453-dcfa-864a7c05e692@yandex.ru> <861qvhj3j4.fsf@mail.linkov.net> <86r13h6syo.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21017"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 54733@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 24 19:32:59 2022 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 1o4nAw-0005EX-V6 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Jun 2022 19:32:58 +0200 Original-Received: from localhost ([::1]:35154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4nAv-0003p8-S4 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Jun 2022 13:32:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4n4F-0005f8-TV for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2022 13:26:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49514) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4n4E-000144-JT for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2022 13:26:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o4n4E-0004Vd-Fu for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2022 13:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jun 2022 17:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54733 X-GNU-PR-Package: emacs Original-Received: via spool by 54733-submit@debbugs.gnu.org id=B54733.165609155017312 (code B ref 54733); Fri, 24 Jun 2022 17:26:02 +0000 Original-Received: (at 54733) by debbugs.gnu.org; 24 Jun 2022 17:25:50 +0000 Original-Received: from localhost ([127.0.0.1]:43411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4n42-0004VA-9O for submit@debbugs.gnu.org; Fri, 24 Jun 2022 13:25:50 -0400 Original-Received: from relay12.mail.gandi.net ([217.70.178.232]:41479) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4n3z-0004Us-8G for 54733@debbugs.gnu.org; Fri, 24 Jun 2022 13:25:49 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id C87FA200006; Fri, 24 Jun 2022 17:25:39 +0000 (UTC) In-Reply-To: <86r13h6syo.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 22 Jun 2022 10:36:39 +0300") 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" Xref: news.gmane.io gmane.emacs.bugs:235210 Archived-At: >>>> + (replace-search search-string limit >>>> + regexp-flag delimited-flag >>>> + case-fold-search backward)) >>> >>> I don't know this code too well, but perhaps SEARCH_STRING here should be >>> anchored with something like "\\=" at the beginning? >>> >>> Otherwise the search can succeed here even if the next match is not >>> here. Not sure how important that is, though. >> >> I'm afraid that prepending "\\=" might break a complex regexp somehow. > > Another variant without modifying the original regexp is still to call > replace-search, but afterwards check if it stayed at the old position A third variant is to add a new variable `looking-at-function' that is like `isearch-search-fun-function', so everyone who needs to redefine the search function, will also need to redefine the looking-at function.