[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 4ca808e: Make sure the new window is not too tall
From: |
Dmitry Gutov |
Subject: |
master 4ca808e: Make sure the new window is not too tall |
Date: |
Mon, 18 Jan 2021 20:05:52 -0500 (EST) |
branch: master
commit 4ca808ee7adda7b17a7dedffbce9e9e49ee4cd93
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
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).
---
lisp/progmodes/xref.el | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index b6778de..aecb30a 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 4ca808e: Make sure the new window is not too tall,
Dmitry Gutov <=