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: Mon, 21 Feb 2022 02:35:24 +0200 Message-ID: <611521ae-42d4-6584-915e-243060de536e@yandex.ru> References: 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="9783"; 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 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?= , 54025@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 21 01:36:35 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 1nLwgt-0002Q3-Ge for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Feb 2022 01:36:35 +0100 Original-Received: from localhost ([::1]:34580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nLwgs-0005Dj-3y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Feb 2022 19:36:34 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nLwgY-0005Cy-TQ for bug-gnu-emacs@gnu.org; Sun, 20 Feb 2022 19:36:14 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40297) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nLwgL-0001vi-Pn for bug-gnu-emacs@gnu.org; Sun, 20 Feb 2022 19:36:14 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nLwgL-0001Kd-L7 for bug-gnu-emacs@gnu.org; Sun, 20 Feb 2022 19:36: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: Mon, 21 Feb 2022 00:36: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.16454037355086 (code B ref 54025); Mon, 21 Feb 2022 00:36:01 +0000 Original-Received: (at 54025) by debbugs.gnu.org; 21 Feb 2022 00:35:35 +0000 Original-Received: from localhost ([127.0.0.1]:34194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLwfv-0001Jy-6g for submit@debbugs.gnu.org; Sun, 20 Feb 2022 19:35:35 -0500 Original-Received: from mail-wr1-f47.google.com ([209.85.221.47]:33457) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLwft-0001Ji-3B for 54025@debbugs.gnu.org; Sun, 20 Feb 2022 19:35:33 -0500 Original-Received: by mail-wr1-f47.google.com with SMTP id e3so24324140wra.0 for <54025@debbugs.gnu.org>; Sun, 20 Feb 2022 16:35:33 -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:references:from:in-reply-to :content-transfer-encoding; bh=XbeyJUNk8kLfbWgErQha5ZJV+nDa2K3DlAmfBS12w2Y=; b=QG0DfQvtzSmTssVr11Xdf0j4YMwfYOnuqpvCZBvgQ8ymLiqeKq7ygN7EVGd/olkVq4 c/H439mTjYScodnb4GxGadcx51Cn3wPuVJmGAg+ErTzendY5kciji53zs/zLBixEIq/k d88iyWuZypQCa2GwmErLtewrG7bzwkmhIQQfaGwqQHhesJsyDMXoC7LBwpcVxRkvGp0o kzvy9bOhWHWLy58BhpU51Noq2iSq6U7ml2+ekc0E6YwtnWL2ecyzCzujgZ9Um5vn18EF neHPkj2MivIfxFNp0Rxw/sIyghecGUZ1YbLwPAH29HMJDpkpeKq6sBa4Kj741EYB8rb9 fOxg== 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:references:from:in-reply-to :content-transfer-encoding; bh=XbeyJUNk8kLfbWgErQha5ZJV+nDa2K3DlAmfBS12w2Y=; b=tj7Gb6mIhIAv00CNAHry/Q27c5NeXAFd2zIq0ihYiMxakGvq7Vgw/NiatCeEKMBMXg U/5dwxmCBc3fqH2RwQDCj84yvEufnaeBmi5WQw3CHTmU7OGOoszzjHlZE/pvTCOtI/Zr qH2NWtwnB4VIIlaCkD8tBepRYFf5EhWLUDaOLyVuzj/9F1KqWDgsIcJ+tIypUAUpODCG smv7TDD3jphEi6hTHIrL4IBcGz80HjQWEMHF/GdNhW0OfRt73Efy6Bvt30YrL3EKBqGY j2hl/04iU3G8E8D2/rQ4rMhZ5rDE/ktMafZusGxDHSNNRD6PrbdEtoWzP5nrqWEe3FNN meoA== X-Gm-Message-State: AOAM531cHZAasGwLwB3EBj/osm6BaB6h3SZvGJxJPNCsotEYNfZdY9UV wNYNfsVqc/hqXm53ON81PDQh3OMi8dU= X-Google-Smtp-Source: ABdhPJzs7xnMyEE3PlxEgQfHUZVr+UPmCjUDWhup4UXDMjsFlxR3qmf3PxZfsW/KqDVzlTeNtKDyvA== X-Received: by 2002:adf:e904:0:b0:1d6:64b3:fdd with SMTP id f4-20020adfe904000000b001d664b30fddmr13746696wrm.200.1645403726969; Sun, 20 Feb 2022 16:35:26 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id az13sm29108270wrb.39.2022.02.20.16.35.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Feb 2022 16:35:26 -0800 (PST) Content-Language: en-US In-Reply-To: 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:227291 Archived-At: 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