bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49731: 28.0.50; Filter xref results by filename


From: Juri Linkov
Subject: bug#49731: 28.0.50; Filter xref results by filename
Date: Tue, 27 Jul 2021 01:53:09 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> (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)))))
>
> This is similar to what I have in mind.  Instead of hardcoding
> "ChangeLog", the proposed command would ask the user for the regular
> expression.  Your command hides entries that match the pattern, but I
> think that for the new command the opposite interpretation is more
> common (only show those entries that match the pattern, and hide
> everything else).  Does it make sense to offer both behaviors? (Like
> flush-lines/keep-lines.)

Indeed, both include/exclude make sense.  In your example
of using "tests/" to get results only from unit tests,
actually in most projects I need exactly the inverse:
to ignore all results from unit tests, because when I need
to get results only from "tests/", then it's easy to run
'C-x p g' (project-find-regexp) with the prefix C-u
and specify the directory to search such as "tests/".

> Another xref-mode-map command bound to "q", for example, would disable
> outline-minor-mode to present the xref buffer with full visibility.

There is 'outline-cycle-buffer' bound to 'S-TAB' that can
enable full visibility, or just 'outline-show-all'.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]