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: Tue, 05 Apr 2022 20:16:19 +0300 Organization: LINKOV.NET Message-ID: <865ynnl9f0.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="3842"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) To: 54733@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 05 19:41:43 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 1nbnBV-0000sz-St for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Apr 2022 19:41:41 +0200 Original-Received: from localhost ([::1]:36136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nbnBU-0001VA-Aa for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Apr 2022 13:41:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbnAs-0001SW-Kk for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 13:41:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nbnAs-0005Z5-9S for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 13:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nbnAs-00027s-7I for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 13:41: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: Tue, 05 Apr 2022 17:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54733 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16491804268107 (code B ref -1); Tue, 05 Apr 2022 17:41:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Apr 2022 17:40:26 +0000 Original-Received: from localhost ([127.0.0.1]:56062 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nbnAI-00026g-9p for submit@debbugs.gnu.org; Tue, 05 Apr 2022 13:40:26 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:51866) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nbnAG-00026V-1G for submit@debbugs.gnu.org; Tue, 05 Apr 2022 13:40:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbnAF-0001R0-7h for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 13:40:23 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:60379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbnAD-0005Q6-0y for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 13:40:22 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id C3C7B20008 for ; Tue, 5 Apr 2022 17:40:13 +0000 (UTC) Received-SPF: pass client-ip=217.70.183.200; envelope-from=juri@linkov.net; helo=relay7-d.mail.gandi.net X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:229453 Archived-At: [This is a spin-off from bug#14013 and bug#53758] There is a long-standing bug in query-replace. The optimization that uses `match-again` and `looking-at` ignores search-related variables such as isearch-search-fun-function, replace-re-search-function, etc. Here's is a test case that demonstrates the problem in current master with the recent addition of dired-isearch-search-filenames: 1. cd /tmp; touch file1; ln -s file1 file2 2. enter Wdired and move point to the beginning of file2 3. C-M-% .* RET foo RET 4. answer `n` when asked to replace `file2` After that the remaining part of the same line is highlighted, i.e. the part after "file2" (that is a symbolic link) in: file2 -> file1 This is because the `match-again` optimization uses `(looking-at ".*")` after the previous replacement "file2" to ask about the next replacement of " -> file1" that ignores isearch-search-fun-function. Also in bug#53758 Dmitry explained that xref--query-replace-1 needed such a hack to let-bind isearch-filter-predicate because of this problem in perform-replace that uses `looking-at` instead of `replace-re-search-function`. So now we have two cases that require fixing perform-replace.