From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#53758: 28.0.91; Recursive edit during dired-do-find-regexp-and-replace breaks isearch Date: Mon, 7 Feb 2022 05:03:38 +0200 Message-ID: <48a0ada9-c386-aca8-e3f4-ecece9defee5@yandex.ru> References: <87mtj7yddd.fsf@earth.mail-host-address-is-not-set> <867da8x7v1.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13775"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Cc: sbaugh@catern.com, 53758@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 07 04:04:34 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 1nGuKO-0003Jn-Rq for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 07 Feb 2022 04:04:32 +0100 Original-Received: from localhost ([::1]:32876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGuKJ-0000At-QL for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Feb 2022 22:04:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGuJv-0000Ah-BX for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 22:04:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46673) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGuJv-0006lD-1Y for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 22:04:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nGuJu-0001J5-QJ for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 22:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Feb 2022 03:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53758 X-GNU-PR-Package: emacs Original-Received: via spool by 53758-submit@debbugs.gnu.org id=B53758.16442030284988 (code B ref 53758); Mon, 07 Feb 2022 03:04:02 +0000 Original-Received: (at 53758) by debbugs.gnu.org; 7 Feb 2022 03:03:48 +0000 Original-Received: from localhost ([127.0.0.1]:40567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGuJg-0001IO-77 for submit@debbugs.gnu.org; Sun, 06 Feb 2022 22:03:48 -0500 Original-Received: from mail-wr1-f53.google.com ([209.85.221.53]:35616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGuJe-0001I5-Fn for 53758@debbugs.gnu.org; Sun, 06 Feb 2022 22:03:46 -0500 Original-Received: by mail-wr1-f53.google.com with SMTP id m5so4950644wrb.2 for <53758@debbugs.gnu.org>; Sun, 06 Feb 2022 19:03:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=qcoY8IL7C8YiKlQ4aI1zeLtb/ydAzM+qMKmzR5HRdlg=; b=lBZLyA0aGEAbrEZYl/YijZb1OyOFRdBGZjJ5Q5NJVUTDiXB6cccg8b8N0h+Hak8rkk vyQtxo5mxgQVpGiiQ37o86F/bS2rC451Xdz04/76hmF+/rjIolwpF4A8Ge35YpACeg8L ImUdeKK4O6O92eFibXj/M7vQM1EWNfb7RGYOVx8eP6lLfplkwigJuIKavEPHz/2lIW39 aY60R9AAKfBCT5gMFWLHQ0cf+HSd5OO0g3S94SJLJNM4X9X6kL2Z/HC6ESRW0MHzS31I uvuQQrLKJiJr71Ff+c634dTOJH+Wa3avulg8cv/djF6o3c/2fu2Z+huYeAlRDlneXQrI MTxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=qcoY8IL7C8YiKlQ4aI1zeLtb/ydAzM+qMKmzR5HRdlg=; b=sNowYTprH1EyZdmiRLe9ELN2eemaSjEpYOyUQG3UVQ9K+OZpcLaFz6HiMBfRuJJ1gk e2S1nas+B54PsioPQnI4HO4GmrqoHeDT9fHF8zmfaqxXZ6Jr9G769Pkg5WMGR3M2bkOf nWtlEmRfLtr8h27H4bzVbftXxsPH4zuNaaJFKb2nO+KiF+tbznW3W7Rwra+JEUKOqKAb dGcraIrKFy9kbM3dxwK7QEu93Q1Q71qPoVkGb9sohgn0xf07iIFaGEBtw04iiNrTS4Zm QxGxmj7XsboPVyjbO+dy48pL9ifZjRE96W/p//GbOLzNUy/Zrib1FrotnscHpruCnJM6 Aovg== X-Gm-Message-State: AOAM531bA8eqnwTuu7W3GgHSgzAxsEiaQOtTJITYmYqOXN2XvYMHCynk QL+sOMK+ZYivd/NqbyPo744= X-Google-Smtp-Source: ABdhPJw93/8zjjTanmU6le2rz4gZMWF7It40kVi+bf/E/djrm8KwusTkSP+9Wd7UQoZ8UfYrYFkpkA== X-Received: by 2002:a5d:4b83:: with SMTP id b3mr3354360wrt.311.1644203020714; Sun, 06 Feb 2022 19:03:40 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id n26sm7943415wms.13.2022.02.06.19.03.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 06 Feb 2022 19:03:39 -0800 (PST) Content-Language: en-US In-Reply-To: <867da8x7v1.fsf@mail.linkov.net> 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:226216 Archived-At: Hi Juri, On 06.02.2022 19:44, Juri Linkov wrote: >> isearch-forward (C-s) while in a recursive edit (C-r) triggered from >> dired-do-find-regexp-and-replace (Q in a dired buffer) always fails to >> find any matches for any string, even if there are matches in the >> buffer. >> >> Steps to reproduce: >> 1. Open a dired buffer in a directory containing at least one file which >> contains some text (e.g. "Hello world") >> 2. Run dired-do-find-regexp-and-replace to replace "Hello" with >> "Goodbye" ("Q Hello RET Goodbye RET"); this will switch buffers >> to the first matching file. >> 3. Type C-r to enter a recursive edit (I'm guessing this runs >> (recursive-edit)?) >> 4. At the start of the buffer, run isearch-forward searching for "world" >> ("C-s world RET") >> 5. Note that the isearch fails despite "world" being in the buffer. >> >> For what it's worth, this interestingly doesn't happen with >> project-query-regexp-replace (which also does multi-file query-replace). > This is because of these lines in xref--query-replace-1: > > ;; Counteract the "do the next match now" hack in > ;; `perform-replace'. And still, it'll report that those > ;; matches were "filtered out" at the end. > (isearch-filter-predicate > (lambda (beg end) > (and current-beg > (>= beg current-beg) > (<= end current-end)))) > > Dmitry, could you please explain the comment above. > What I don't understand is where this > "the next match now" hack is in `perform-replace'? It's referring to the comment on lines starting with 2938 and the subsequent code which uses 'looking-at' instead of replace-re-search-function. Here's that comment in full: ;; Otherwise, if matching a regular expression, do the next ;; match now, since the replacement for this match may ;; affect whether the next match is adjacent to this one. ;; If that match is empty, don't use it. I'm not sure why the result would be different between dired-do-find-regexp-and-replace and project-query-regexp-replace, though.