From 3573ebfa6d94411257ffefdf9eb72f508dbe502c Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 23 Nov 2022 10:38:28 +0200 Subject: [PATCH] * lisp/progmodes/xref.el: Support outline-minor-mode (bug#49731) (xref--xref-buffer-mode): Set buffer-local variables outline-minor-mode-cycle, outline-minor-mode-use-buttons, outline-search-function, outline-level as settings for enabling outline-minor-mode in xref output buffers where outline headings are xref groups, and their lines can be hidden by outline commands. --- lisp/progmodes/xref.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 89a090ae932..139929dc8a4 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -919,6 +919,8 @@ ITEMS is an xref item which " ; FIXME: Expand documentation. (define-key map (kbd "M-,") #'xref-quit-and-pop-marker-stack) map)) +(declare-function outline-search-text-property "outline" (property &optional value bound move backward looking-at)) + (define-derived-mode xref--xref-buffer-mode special-mode "XREF" "Mode for displaying cross-references." (setq buffer-read-only t) @@ -927,7 +929,14 @@ ITEMS is an xref item which " ; FIXME: Expand documentation. (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-minor-mode-cycle t + outline-minor-mode-use-buttons t + 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))) -- 2.39.5