From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?=D0=9F=D0=B5=D1=82=D1=80=D0=BE=D0=B2_?= =?UTF-8?Q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9?= Newsgroups: gmane.emacs.bugs Subject: bug#54025: 27.2; dired-do-find-regexp skips occurences Date: Thu, 24 Feb 2022 07:25:35 +0000 Message-ID: <8017fbd711264d36ba69b62c480a55c6@pay-lab.ru> References: <611521ae-42d4-6584-915e-243060de536e@yandex.ru> <831qzwx5a6.fsf@gnu.org> <967624c188c942ff8ecbf23bd6be46d0@pay-lab.ru> <0239f68191344ab49b23ddc96c7bd6e9@pay-lab.ru>, Mime-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11949"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "54025@debbugs.gnu.org" <54025@debbugs.gnu.org> To: Dmitry Gutov , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 24 08:26:49 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 1nN8WW-0002ya-6o for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Feb 2022 08:26:48 +0100 Original-Received: from localhost ([::1]:42552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nN8WU-0003Cu-Ke for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Feb 2022 02:26:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN8Vm-0003Ce-6I for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2022 02:26:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nN8Vl-0004Pu-Td for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2022 02:26:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nN8Vl-0006j6-Qh for bug-gnu-emacs@gnu.org; Thu, 24 Feb 2022 02:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=D0=9F=D0=B5=D1=82=D1=80=D0=BE=D0=B2_?= =?UTF-8?Q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Feb 2022 07:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54025 X-GNU-PR-Package: emacs Original-Received: via spool by 54025-submit@debbugs.gnu.org id=B54025.164568754625834 (code B ref 54025); Thu, 24 Feb 2022 07:26:01 +0000 Original-Received: (at 54025) by debbugs.gnu.org; 24 Feb 2022 07:25:46 +0000 Original-Received: from localhost ([127.0.0.1]:47391 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nN8VW-0006ic-6g for submit@debbugs.gnu.org; Thu, 24 Feb 2022 02:25:46 -0500 Original-Received: from mail2.itgrp.ru ([87.251.91.230]:35293) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nN8VU-0006iN-9x for 54025@debbugs.gnu.org; Thu, 24 Feb 2022 02:25:44 -0500 IronPort-SDR: 4PdIpSkFUEh6gjy9SZWJrwbDWVzcCXs9QqZNwvnwWSvMig10+srIYGhb13uuSiEjJFmB0Rpsj4 vSbFHz90VEhA== X-IronPort-AV: E=Sophos;i="5.88,393,1635195600"; d="scan'208";a="154402316" Thread-Topic: bug#54025: 27.2; dired-do-find-regexp skips occurences Thread-Index: AQHYIyjXtspqEmtb7Emo34ft0KOoIayc/TcAgABkI0mAADe4/YACqySAgAB1HP6AASCpgIAAfuOK In-Reply-To: Accept-Language: ru-RU, en-US Content-Language: ru-RU x-originating-ip: [10.24.4.20] 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:227563 Archived-At: Dmitry, I tested your patch. As for me, it works the best way! =F3 =D5=D7=C1=D6=C5=CE=C9=C5=CD, =E1=CE=C4=D2=C5=CA =F0=C5=D4=D2=CF=D7, =D0=D2=CF=C7=D2=C1=CD=CD=C9=D3=D4 =EF=EF=EF =E9=CE=D0=C1=D3-=F3=CF=C6=D4. ________________________________________ =EF=D4: DG =CF=D4 =C9=CD=C5=CE=C9 Dmitry Gutov =EF=D4=D0=D2=C1=D7=CC=C5=CE=CF: 24 =C6=C5=D7=D2=C1=CC=D1 2022 =C7. 7:50:35 =EB=CF=CD=D5: =F0=C5=D4=D2=CF=D7 =E1=CE=C4=D2=C5=CA; Eli Zaretskii =EB=CF=D0=C9=D1: 54025@debbugs.gnu.org =F4=C5=CD=C1: Re: bug#54025: 27.2; dired-do-find-regexp skips occurences On 23.02.2022 09:01, =F0=C5=D4=D2=CF=D7 =E1=CE=C4=D2=C5=CA wrote: > It seems that processing unmodified (or not open) files with grep and mod= ified ones with searching in buffers would be a well-balanced approach savi= ng both memory and possible network traffic (or SSD rewrite cycles) but thi= s is rather feature to make in the future then a hot fix )). This, together with the previous discussion, gave me an idea. Do you personally want to be prompted to save the buffers? If not, we could just do the "with appropriate logging" part. More than that, when the buffer is unsaved, we can just process the text returned by grep in a temp buffer (which is what we do for all non-visited files anyway). So, how about just the change below? Or should we add the prompting to save as well? diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index aa98aa89f1..96fb835d0f 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -2010,10 +2010,16 @@ xref--collect-matches-1 (defun xref--find-file-buffer (file) (unless (equal (car xref--last-file-buffer) file) - (setq xref--last-file-buffer - ;; `find-buffer-visiting' is considerably slower, - ;; especially on remote files. - (cons file (get-file-buffer file)))) + ;; `find-buffer-visiting' is considerably slower, + ;; especially on remote files. + (let ((buf (get-file-buffer file))) + (when (and buf + (or + (buffer-modified-p buf) + (not (verify-visited-file-modtime (current-buffer))))) + ;; We can't use buffers whose contents diverge from disk (bug#54025). + (setq buf nil)) + (setq xref--last-file-buffer (cons file buf)))) (cdr xref--last-file-buffer)) (provide 'xref)