diff options
| author | Dmitry Gutov | 2021-01-19 03:05:44 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2021-01-19 03:05:44 +0200 |
| commit | 4ca808ee7adda7b17a7dedffbce9e9e49ee4cd93 (patch) | |
| tree | 44c4f89f4f9f1e5a8776d36b4e40623ad14c2c95 | |
| parent | 35119b2bc0fd602a19fa0b07d305592d139be6a8 (diff) | |
| download | emacs-4ca808ee7adda7b17a7dedffbce9e9e49ee4cd93.tar.gz emacs-4ca808ee7adda7b17a7dedffbce9e9e49ee4cd93.zip | |
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." | |||
| 1001 | When there is more than one definition, split the selected window | 1001 | When there is more than one definition, split the selected window |
| 1002 | and show the list in a small window at the bottom. And use a | 1002 | and show the list in a small window at the bottom. And use a |
| 1003 | local keymap that binds `RET' to `xref-quit-and-goto-xref'." | 1003 | local keymap that binds `RET' to `xref-quit-and-goto-xref'." |
| 1004 | (let ((xrefs (funcall fetcher)) | 1004 | (let* ((xrefs (funcall fetcher)) |
| 1005 | (dd default-directory)) | 1005 | (dd default-directory) |
| 1006 | ;; XXX: Make percentage customizable maybe? | ||
| 1007 | (max-height (/ (window-height) 2)) | ||
| 1008 | (size-fun (lambda (window) | ||
| 1009 | (fit-window-to-buffer window max-height)))) | ||
| 1006 | (cond | 1010 | (cond |
| 1007 | ((not (cdr xrefs)) | 1011 | ((not (cdr xrefs)) |
| 1008 | (xref-pop-to-location (car xrefs) | 1012 | (xref-pop-to-location (car xrefs) |
| @@ -1013,7 +1017,8 @@ local keymap that binds `RET' to `xref-quit-and-goto-xref'." | |||
| 1013 | (xref--transient-buffer-mode) | 1017 | (xref--transient-buffer-mode) |
| 1014 | (xref--show-common-initialize (xref--analyze xrefs) fetcher alist) | 1018 | (xref--show-common-initialize (xref--analyze xrefs) fetcher alist) |
| 1015 | (pop-to-buffer (current-buffer) | 1019 | (pop-to-buffer (current-buffer) |
| 1016 | '(display-buffer-in-direction . ((direction . below)))) | 1020 | `(display-buffer-in-direction . ((direction . below) |
| 1021 | (window-height . ,size-fun)))) | ||
| 1017 | (current-buffer)))))) | 1022 | (current-buffer)))))) |
| 1018 | 1023 | ||
| 1019 | (define-obsolete-function-alias 'xref--show-defs-buffer-at-bottom | 1024 | (define-obsolete-function-alias 'xref--show-defs-buffer-at-bottom |