* 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.
This commit is contained in:
Juri Linkov 2022-11-23 10:38:28 +02:00
parent 5e8c62ffca
commit 3573ebfa6d

View file

@ -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)))