diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2021-01-19 03:05:44 +0200 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2021-01-19 03:05:44 +0200 |
commit | 4ca808ee7adda7b17a7dedffbce9e9e49ee4cd93 (patch) | |
tree | 44c4f89f4f9f1e5a8776d36b4e40623ad14c2c95 | |
parent | 35119b2bc0fd602a19fa0b07d305592d139be6a8 (diff) | |
download | emacs-4ca808ee7adda7b17a7dedffbce9e9e49ee4cd93.tar.gz |
Make sure the new window is not too tall
* lisp/progmodes/xref.el (xref-show-definitions-buffer-at-bottom):
Make sure the new window is not too tall (bug#45945).
-rw-r--r-- | lisp/progmodes/xref.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index b6778de807d..aecb30a0ad4 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1001,8 +1001,12 @@ When only one definition found, jump to it right away instead." 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)) + (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)))) (cond ((not (cdr xrefs)) (xref-pop-to-location (car xrefs) @@ -1013,7 +1017,8 @@ local keymap that binds `RET' to `xref-quit-and-goto-xref'." (xref--transient-buffer-mode) (xref--show-common-initialize (xref--analyze xrefs) fetcher alist) (pop-to-buffer (current-buffer) - '(display-buffer-in-direction . ((direction . below)))) + `(display-buffer-in-direction . ((direction . below) + (window-height . ,size-fun)))) (current-buffer)))))) (define-obsolete-function-alias 'xref--show-defs-buffer-at-bottom |