From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#49731: 28.0.50; Filter xref results by filename Date: Sun, 25 Jul 2021 23:43:55 +0300 Organization: LINKOV.NET Message-ID: <87lf5urv4c.fsf@mail.linkov.net> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4459"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: mardani29@yahoo.es To: 49731@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 25 22:59:20 2021 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 1m7lDT-000135-Dz for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 25 Jul 2021 22:59:19 +0200 Original-Received: from localhost ([::1]:42642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7lDS-0007BO-EL for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 25 Jul 2021 16:59:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7lDD-0007Ap-1F for bug-gnu-emacs@gnu.org; Sun, 25 Jul 2021 16:59:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37950) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7lDC-0001bb-QB for bug-gnu-emacs@gnu.org; Sun, 25 Jul 2021 16:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m7lDC-0000sm-Qi for bug-gnu-emacs@gnu.org; Sun, 25 Jul 2021 16:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Jul 2021 20:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49731 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: Daniel =?UTF-8?Q?Mart=C3=ADn?= , 49731@debbugs.gnu.org Original-Received: via spool by 49731-submit@debbugs.gnu.org id=B49731.16272467033300 (code B ref 49731); Sun, 25 Jul 2021 20:59:02 +0000 Original-Received: (at 49731) by debbugs.gnu.org; 25 Jul 2021 20:58:23 +0000 Original-Received: from localhost ([127.0.0.1]:49488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m7lCY-0000rA-TE for submit@debbugs.gnu.org; Sun, 25 Jul 2021 16:58:23 -0400 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:44407) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m7lCX-0000qq-6L for 49731@debbugs.gnu.org; Sun, 25 Jul 2021 16:58:21 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id DBB0CC0003; Sun, 25 Jul 2021 20:58:12 +0000 (UTC) In-Reply-To: ("Daniel =?UTF-8?Q?Mart=C3=ADn?= via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\""'s message of "Sun, 25 Jul 2021 10:19:52 +0200") 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:210735 Archived-At: > I plan to implement a new feature for xref, but I'd like to get some > opinions first: > > Sometimes an xref backend returns a lot of results spread over several > files. This usually happens in huge projects and for certain operations > like "search references". To make them more manageable, I propose a new > command that can filter xref result groups (typically filenames) by a > regular expression. A user could filter by "tests/", or something like > that, to only get results from unit tests. I have exactly the same problem while using xref on the Emacs source tree: most of the time I'm not interested in the results found in ChangeLog files, so I want to ignore all ChangeLog files, and only ChangeLog files. This problem was solved by enabling outline-minor-mode on the xref output, then collapsing all ChangeLog entries automatically: #+begin_src emacs-lisp (add-hook 'xref-after-update-hook (lambda () (setq-local outline-regexp (if (eq xref-file-name-display 'abs) "/" "[^ 0-9]")) (outline-minor-mode +1) (save-excursion (goto-char (point-min)) (while (search-forward "ChangeLog" nil t) (outline-cycle))))) #+end_src > Right now the only approach I know for this use case is to use Isearch, > but Isearch searches the entire xref buffer, including xref matches. You can use isearch-filter-predicate to match only on file names. There is an example of this feature in dired-isearch-filenames-mode.