summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2022-11-23 10:38:28 +0200
committerJuri Linkov <juri@linkov.net>2022-11-23 10:38:28 +0200
commit3573ebfa6d94411257ffefdf9eb72f508dbe502c (patch)
tree7c1429619de3aec994197cd9a8a23083390ea57d /lisp
parent5e8c62ffcae473b89e268e0081d4041fb19abef7 (diff)
downloademacs-3573ebfa6d94411257ffefdf9eb72f508dbe502c.tar.gz
emacs-3573ebfa6d94411257ffefdf9eb72f508dbe502c.tar.bz2
emacs-3573ebfa6d94411257ffefdf9eb72f508dbe502c.zip
* 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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/xref.el11
1 files changed, 10 insertions, 1 deletions
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)))