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: Wed, 23 Feb 2022 07:01:09 +0000 Message-ID: <0239f68191344ab49b23ddc96c7bd6e9@pay-lab.ru> References: <611521ae-42d4-6584-915e-243060de536e@yandex.ru> <831qzwx5a6.fsf@gnu.org> <967624c188c942ff8ecbf23bd6be46d0@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="32921"; 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 Wed Feb 23 08:02:22 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 1nMlfJ-0008PP-MV for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Feb 2022 08:02:21 +0100 Original-Received: from localhost ([::1]:59214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMlfI-0001Bs-M5 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Feb 2022 02:02:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMlf0-00017F-TF for bug-gnu-emacs@gnu.org; Wed, 23 Feb 2022 02:02:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49751) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMlf0-0007KU-Gc for bug-gnu-emacs@gnu.org; Wed, 23 Feb 2022 02:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nMlf0-0007w6-C6 for bug-gnu-emacs@gnu.org; Wed, 23 Feb 2022 02:02:02 -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: Wed, 23 Feb 2022 07:02:02 +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.164559967930448 (code B ref 54025); Wed, 23 Feb 2022 07:02:02 +0000 Original-Received: (at 54025) by debbugs.gnu.org; 23 Feb 2022 07:01:19 +0000 Original-Received: from localhost ([127.0.0.1]:43648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMleI-0007v0-MQ for submit@debbugs.gnu.org; Wed, 23 Feb 2022 02:01:18 -0500 Original-Received: from mail1.itgrp.ru ([185.8.182.248]:43618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMleG-0007ul-G6 for 54025@debbugs.gnu.org; Wed, 23 Feb 2022 02:01:17 -0500 IronPort-SDR: fNPnGU/ZRMM+xwAyYHWCyKm8RK+NuMokIxgq6WeP0iNBkyQqYb5w8z9n2qBe8HR44QepnrVTZY 3Rsuo58CUg6w== X-IronPort-AV: E=Sophos;i="5.88,390,1635195600"; d="scan'208";a="159706328" Thread-Topic: bug#54025: 27.2; dired-do-find-regexp skips occurences Thread-Index: AQHYIyjXtspqEmtb7Emo34ft0KOoIayc/TcAgABkI0mAADe4/YACqySAgAB1HP4= 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:227481 Archived-At: Dmitry, Looks great! RecentlyI found a function `dired-do-search' which uses searching in buffer= s (and sees unsaved occurences). It seems that processing unmodified (or no= t open) files with grep and modified ones with searching in buffers would b= e 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 th= en a hot fix )). People who expect searching in modified buffers still can use `dired-do-sea= rch' and `dired-do-query-replace-regexp' which may work slower. So I think the current decision is OK. Best regards, Andrey Petrov. ________________________________________ =EF=D4: DG =CF=D4 =C9=CD=C5=CE=C9 Dmitry Gutov =EF=D4=D0=D2=C1=D7=CC=C5=CE=CF: 23 =C6=C5=D7=D2=C1=CC=D1 2022 =C7. 7:38:17 =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 21.02.2022 09:00, =F0=C5=D4=D2=CF=D7 =E1=CE=C4=D2=C5=CA wrote: > I think it is convenient to ask user to save some buffers (like `rgrep' d= o) if the search algorithm implementation requires all files to be saved. O= ptionally modified buffers can be skipped with appropriate logging into mes= sages buffer. How about this? diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 56897826cb..16094f4551 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3272,6 +3272,7 @@ dired-do-find-regexp (require 'xref) (defvar grep-find-ignored-files) (declare-function rgrep-find-ignored-directories "grep" (dir)) + (save-some-buffers) (let* ((marks (dired-get-marked-files nil nil nil nil t)) (ignores (nconc (mapcar #'file-name-as-directory diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 880c5b5517..f772871f72 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -834,6 +834,7 @@ project-or-external-find-regexp nil))) (defun project--find-regexp-in-files (regexp files) + (save-some-buffers) (unless files (user-error "Empty file list")) (let ((xrefs (xref-matches-in-files regexp files))) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index aa98aa89f1..ae19632974 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -273,6 +273,7 @@ xref-backend-references The default implementation uses `semantic-symref-tool-alist' to find a search tool; by default, this uses \"find | grep\" in the current project's main and external roots." + (save-some-buffers) (mapcan (lambda (dir) (message "Searching %s..." dir) @@ -2013,7 +2014,9 @@ xref--find-file-buffer (setq xref--last-file-buffer ;; `find-buffer-visiting' is considerably slower, ;; especially on remote files. - (cons file (get-file-buffer file)))) + (cons file (get-file-buffer file))) + (when (buffer-modified-p (cdr xref--last-file-buffer)) + (message "Buffer %s has unsaved changes" (cdr xref--last-file-buffer)))) (cdr xref--last-file-buffer)) (provide 'xref)