GNU bug report logs - #49731
28.0.50; Filter xref results by filename

Previous Next

Package: emacs;

Reported by: Daniel Martín <mardani29 <at> yahoo.es>

Date: Sun, 25 Jul 2021 08:21:02 UTC

Severity: normal

Found in version 28.0.50

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #80 received at 49731 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: 49731 <at> debbugs.gnu.org
Subject: Re: bug#49731: 28.0.50; Filter xref results by filename
Date: Mon, 21 Nov 2022 09:58:43 +0200
>> 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.)
>
> Now a new feature was implemented in bug#51809 that allows
> easy customization of the new options outline-default-state
> and outline-default-rules, for example:
>
> #+begin_src emacs-lisp
> (add-hook 'xref-after-update-hook
>           (lambda ()
>             (setq-local outline-regexp
>                         (if (eq xref-file-name-display 'abs) "/" "[^ 0-9]")

And now a new feature implemented in bug#53981 allows to replace
the unreliable line above with using outline-search-function:

```
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 89a090ae932..1ef2ea74e26 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -927,7 +911,12 @@ xref--xref-buffer-mode
   (setq imenu-prev-index-position-function
         #'xref--imenu-prev-index-position)
   (setq imenu-extract-index-name-function
-        #'xref--imenu-extract-index-name))
+        #'xref--imenu-extract-index-name)
+  (setq-local outline-search-function
+              (lambda (&optional bound move backward looking-at)
+                (outline-search-text-property
+                 'xref-group nil bound move backward looking-at))
+              outline-level (lambda () 1)))
 
 (defvar xref--transient-buffer-mode-map
   (let ((map (make-sparse-keymap)))
```




This bug report was last modified 1 year and 49 days ago.

Previous Next


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