Function: xref-show-definitions-buffer-at-bottom
xref-show-definitions-buffer-at-bottom is a byte-compiled function
defined in xref.el.gz.
Signature
(xref-show-definitions-buffer-at-bottom FETCHER ALIST)
Documentation
Show the definitions list in a window at the bottom.
When there is more than one definition, split the selected window
and show the list in a small window at the bottom. And use a
local keymap that binds RET to xref-quit-and-goto-xref.
Probably introduced at or before Emacs version 28.1.
Aliases
xref--show-defs-buffer-at-bottom (obsolete since 28.1)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/xref.el.gz
(defun xref-show-definitions-buffer-at-bottom (fetcher alist)
"Show the definitions list in a window at the bottom.
When there is more than one definition, split the selected window
and show the list in a small window at the bottom. And use a
local keymap that binds `RET' to `xref-quit-and-goto-xref'."
(let* ((xrefs (funcall fetcher))
(dd default-directory)
;; XXX: Make percentage customizable maybe?
(max-height (/ (window-height) 2))
(size-fun (lambda (window)
(fit-window-to-buffer window max-height)))
xref-alist
buf)
(cond
((not (cdr xrefs))
(xref-pop-to-location (car xrefs)
(assoc-default 'display-action alist)))
(t
;; Call it here because it can call (project-current), and that
;; might depend on individual buffer, not just directory.
(setq xref-alist (xref--analyze xrefs))
(with-current-buffer (get-buffer-create xref-buffer-name)
(xref--ensure-default-directory dd (current-buffer))
(xref--transient-buffer-mode)
(xref--show-common-initialize xref-alist fetcher alist)
(pop-to-buffer (current-buffer)
`(display-buffer-in-direction . ((direction . below)
(window-height . ,size-fun))))
(setq buf (current-buffer)))
(xref--auto-jump-first buf (assoc-default 'auto-jump alist))
buf))))