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: Sun, 16 Jan 2022 20:52:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>> #+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
>
> 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]")
                        outline-default-state 1
                        outline-default-rules '((match-regexp . "ChangeLog")))
            (outline-minor-mode +1)))
#+end_src





reply via email to

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