From: Dmitry Gutov <dgutov@yandex.ru>
To: "Петров Андрей" <an.petrov@pay-lab.ru>, 54025@debbugs.gnu.org
Subject: bug#54025: 27.2; dired-do-find-regexp skips occurences
Date: Mon, 21 Feb 2022 02:35:24 +0200 [thread overview]
Message-ID: <611521ae-42d4-6584-915e-243060de536e@yandex.ru> (raw)
In-Reply-To: <ced1c020985a42fd8bd77c4ea8ee58a1@pay-lab.ru>
Hi!
On 16.02.2022 13:40, Петров Андрей wrote:
> 5. Go back to dired buffer and try searching for "aaa" again.
>
> Now*xref* does not contain 3.txt file although it has an occurence of
> "aaa".
>
> /home/andrey/3/1.txt
> 1: aaa
> /home/andrey/3/2.txt
> 1: aaa
>
> After saving 3.txt and repeating the search*xref* buffers shows all 3
> entries as expected.
>
> Please take a look into `xref-revert-buffer' (g) inside*xref* buffer
> also. It seems that it shows only occurences of the first file.
The reason this happens is because xref-matches-in-files uses the
contents of open buffers to verify the regexp matches, and to show the
(possibly syntax-highlighted) text in matches. The fact that such
buffers can be modified and unsaved is obviously a problem.
I suggest we simply add a check before doing a search, which will remind
you to save any such buffers. It will need to be added to
project-find-regexp as well, naturally. Something like the patch below.
What do you think?
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 41c45b4e51..c3b1b620bb 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -3266,6 +3266,12 @@ dired-do-find-regexp
(require 'xref)
(defvar grep-find-ignored-files)
(declare-function rgrep-find-ignored-directories "grep" (dir))
+ (save-some-buffers)
+ (or (not (memq t (mapcar (lambda (buf)
+ (and (buffer-file-name buf)
+ (buffer-modified-p buf)))
+ (buffer-list))))
+ (user-error "Modified buffers exist; aborting"))
(let* ((marks (dired-get-marked-files nil nil nil nil t))
(ignores (nconc (mapcar
#'file-name-as-directory
next prev parent reply other threads:[~2022-02-21 0:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 11:40 bug#54025: 27.2; dired-do-find-regexp skips occurences Петров Андрей
2022-02-21 0:35 ` Dmitry Gutov [this message]
2022-02-21 3:33 ` Eli Zaretskii
2022-02-21 7:00 ` Петров Андрей
2022-02-21 23:58 ` Dmitry Gutov
2022-02-23 2:38 ` Dmitry Gutov
2022-02-23 7:01 ` Петров Андрей
2022-02-24 2:50 ` Dmitry Gutov
2022-02-24 7:25 ` Петров Андрей
2022-02-25 1:38 ` Dmitry Gutov
2022-02-25 8:13 ` Michael Albinus
2022-02-25 13:47 ` Dmitry Gutov
2022-02-25 15:05 ` Michael Albinus
2022-02-26 0:28 ` Dmitry Gutov
2022-02-26 11:56 ` Michael Albinus
2022-02-26 14:54 ` Петров Андрей
2022-02-27 2:50 ` Dmitry Gutov
2022-02-27 12:50 ` Петров Андрей
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=611521ae-42d4-6584-915e-243060de536e@yandex.ru \
--to=dgutov@yandex.ru \
--cc=54025@debbugs.gnu.org \
--cc=an.petrov@pay-lab.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).