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#54025: 27.2; dired-do-find-regexp skips occurences Date: Thu, 24 Feb 2022 04:50:35 +0200 Message-ID: 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=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21925"; 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: "54025@debbugs.gnu.org" <54025@debbugs.gnu.org> To: =?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?= , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 24 03:51:09 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 1nN4Dl-0005Yj-Hm for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Feb 2022 03:51:09 +0100 Original-Received: from localhost ([::1]:60714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nN4Dk-0002Fv-51 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Feb 2022 21:51:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN4De-0002Fe-9f for bug-gnu-emacs@gnu.org; Wed, 23 Feb 2022 21:51:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53073) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nN4De-00063q-0l for bug-gnu-emacs@gnu.org; Wed, 23 Feb 2022 21:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nN4Dd-0002Vb-VI for bug-gnu-emacs@gnu.org; Wed, 23 Feb 2022 21:51:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Feb 2022 02:51: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.16456710449618 (code B ref 54025); Thu, 24 Feb 2022 02:51:01 +0000 Original-Received: (at 54025) by debbugs.gnu.org; 24 Feb 2022 02:50:44 +0000 Original-Received: from localhost ([127.0.0.1]:46970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nN4DM-0002V3-F7 for submit@debbugs.gnu.org; Wed, 23 Feb 2022 21:50:44 -0500 Original-Received: from mail-wr1-f46.google.com ([209.85.221.46]:46617) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nN4DL-0002Ur-C4 for 54025@debbugs.gnu.org; Wed, 23 Feb 2022 21:50:43 -0500 Original-Received: by mail-wr1-f46.google.com with SMTP id j22so782416wrb.13 for <54025@debbugs.gnu.org>; Wed, 23 Feb 2022 18:50:43 -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=38KZY3Z2fOFIrY5wDyBMw0QpdeSTSx/oWO4A8r96ZMQ=; b=Md9QBHR9rZab2G/lpdmVT0zCIP4r8HjwEC0opYE1bVjH/hOvELFprDTCvFNj5j4nBg BVfKW2pnjKMymg7GlLp94MWbSpYi8qLXtMGKtDi2kcYHaS5HUm4Tgp26rkug6Vi8RGTX 0YINIl8IdsEtgvUUtVaJLXEA/VX5YPpj94F2cEf+A44b7LRqBER7sRk/q8C4pVK6UBS1 A28iuos9Xk5A63VP5RIyk5qsOtSHQqnO8Fj/T84oR0bya81FBewgph1cdwxUIkp3pxnh HfLNECO00ISNBR0O6/KcaI3votw2gzSKo2Y3ikP9xtAJ2KahPF1K8iZlOVv7PV/e0Gin NGRg== 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=38KZY3Z2fOFIrY5wDyBMw0QpdeSTSx/oWO4A8r96ZMQ=; b=rKLV1E+dmaWnJGpiSeOwMPfa/zD/0u17dB/ZHqj0MPGsNcnQ6XHWx2tqqM5E/4X6Ac fEJN0qQ6LQ6PLTfB6T/TdCuBdaP+76fTdQUefoPv+s1UCWzdAjvgPc6U4D3CYFXsdXw6 uW89W9IlB4VxgbuWodX/IUHdkjCQFuyDjevfnJGCou+H7WEDdlY35D4Asch9nzlTh+Up 9yZ3CdZEX0w33oQnbBYlETinZ9Ke9NN8OAhWAwiP5irH3Mb5okz2mwkg/3bA6a0tgcLU Tfh7az6I12ssnDgUeO3CYZCWw0NcRb3MtUzz0xpEHK7UQ4voppYZixsw2wqiySY+WSYf ZgUQ== X-Gm-Message-State: AOAM531bAGAeIHjJxyzmk3S8UDZ/gYsJqhhO9XUShXingrCPEevGgSoh 3Osx8wsAMWRycYrf+mHWidg= X-Google-Smtp-Source: ABdhPJxEo37+2+Vr2yJWL8949D+bQVsXqZXeqmm+btinpRaMZToIRUmMsdolAhVO8+6UFeNAiI0aEA== X-Received: by 2002:a05:6000:108b:b0:1e3:222a:25dd with SMTP id y11-20020a056000108b00b001e3222a25ddmr425001wrw.481.1645671037185; Wed, 23 Feb 2022 18:50:37 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id k19-20020a05600c479300b00380e461a4d2sm1541741wmo.0.2022.02.23.18.50.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Feb 2022 18:50:36 -0800 (PST) Content-Language: en-US In-Reply-To: <0239f68191344ab49b23ddc96c7bd6e9@pay-lab.ru> 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:227554 Archived-At: On 23.02.2022 09:01, Петров Андрей wrote: > It seems that processing unmodified (or not open) files with grep and modified ones with searching in buffers would be a well-balanced approach saving both memory and possible network traffic (or SSD rewrite cycles) but this 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)