GNU bug report logs - #54025
27.2; dired-do-find-regexp skips occurences

Previous Next

Package: emacs;

Reported by: Петров Андрей <an.petrov <at> pay-lab.ru>

Date: Wed, 16 Feb 2022 11:41:01 UTC

Severity: normal

Found in version 27.2

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Петров Андрей <an.petrov <at> pay-lab.ru>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "54025 <at> debbugs.gnu.org" <54025 <at> debbugs.gnu.org>
Subject: bug#54025: 27.2; dired-do-find-regexp skips occurences
Date: Wed, 23 Feb 2022 04:38:17 +0200
On 21.02.2022 09:00, Петров Андрей wrote:
> I think it is convenient to ask user to save some buffers (like `rgrep' do) if the search algorithm implementation requires all files to be saved. Optionally modified buffers can be skipped with appropriate logging into messages 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)




This bug report was last modified 3 years and 114 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.