aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/help.el4
-rw-r--r--lisp/window.el70
2 files changed, 44 insertions, 30 deletions
diff --git a/lisp/help.el b/lisp/help.el
index 1826cb7219a..46136d91003 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1163,8 +1163,8 @@ size of WINDOW."
1163 (and (window-combined-p window t) 1163 (and (window-combined-p window t)
1164 fit-window-to-buffer-horizontally))) 1164 fit-window-to-buffer-horizontally)))
1165 (and (eq quit-cadr 'frame) 1165 (and (eq quit-cadr 'frame)
1166 fit-frame-to-buffer 1166 fit-frame-to-buffer
1167 (eq window (frame-root-window window)))) 1167 (eq window (frame-root-window window))))
1168 (fit-window-to-buffer window height nil width nil t)))) 1168 (fit-window-to-buffer window height nil width nil t))))
1169 1169
1170;;; Help windows. 1170;;; Help windows.
diff --git a/lisp/window.el b/lisp/window.el
index a4ed9ea7216..1a76ecec34d 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4358,11 +4358,18 @@ nil means to not handle the buffer in a particular way. This
4358 (eq (nth 3 quit-restore) buffer)) 4358 (eq (nth 3 quit-restore) buffer))
4359 ;; Show another buffer stored in quit-restore parameter. 4359 ;; Show another buffer stored in quit-restore parameter.
4360 (when (and (integerp (nth 3 quad)) 4360 (when (and (integerp (nth 3 quad))
4361 (/= (nth 3 quad) (window-total-height window))) 4361 (if (window-combined-p window)
4362 (/= (nth 3 quad) (window-total-height window))
4363 (/= (nth 3 quad) (window-total-width window))))
4362 ;; Try to resize WINDOW to its old height but don't signal an 4364 ;; Try to resize WINDOW to its old height but don't signal an
4363 ;; error. 4365 ;; error.
4364 (condition-case nil 4366 (condition-case nil
4365 (window-resize window (- (nth 3 quad) (window-total-height window))) 4367 (window-resize
4368 window
4369 (- (nth 3 quad) (if (window-combined-p window)
4370 (window-total-height window)
4371 (window-total-width window)))
4372 (window-combined-p window t))
4366 (error nil))) 4373 (error nil)))
4367 (set-window-dedicated-p window nil) 4374 (set-window-dedicated-p window nil)
4368 ;; Restore WINDOW's previous buffer, start and point position. 4375 ;; Restore WINDOW's previous buffer, start and point position.
@@ -5500,7 +5507,9 @@ element is BUFFER."
5500 ;; Preserve window-point-insertion-type (Bug#12588). 5507 ;; Preserve window-point-insertion-type (Bug#12588).
5501 (copy-marker 5508 (copy-marker
5502 (window-point window) window-point-insertion-type) 5509 (window-point window) window-point-insertion-type)
5503 (window-total-height window)) 5510 (if (window-combined-p window)
5511 (window-total-height window)
5512 (window-total-width window)))
5504 (selected-window) buffer))))) 5513 (selected-window) buffer)))))
5505 ((eq type 'window) 5514 ((eq type 'window)
5506 ;; WINDOW has been created on an existing frame. 5515 ;; WINDOW has been created on an existing frame.
@@ -6081,33 +6090,38 @@ represents a live window, nil otherwise."
6081 )) 6090 ))
6082 frame)))) 6091 frame))))
6083 6092
6084(defcustom even-window-heights t 6093(defcustom even-window-sizes t
6085 "If non-nil `display-buffer' will try to even window heights. 6094 "If non-nil `display-buffer' will try to even window sizes.
6086Otherwise `display-buffer' will leave the window configuration 6095Otherwise `display-buffer' will leave the window configuration
6087alone. Heights are evened only when `display-buffer' chooses a 6096alone. Special values are `height-only' to even heights only and
6088window that appears above or below the selected window." 6097`width-only' to even widths only. Any other value means to even
6098any of them."
6089 :type 'boolean 6099 :type 'boolean
6090 :group 'windows) 6100 :group 'windows)
6091 6101(defvaralias 'even-window-heights 'even-window-sizes)
6092(defun window--even-window-heights (window) 6102
6093 "Even heights of WINDOW and selected window. 6103(defun window--even-window-sizes (window)
6094Do this only if these windows are vertically adjacent to each 6104 "Even sizes of WINDOW and selected window.
6095other, `even-window-heights' is non-nil, and the selected window 6105Even only if these windows are the only children of their parent,
6096is higher than WINDOW." 6106`even-window-sizes' has the appropriate value and the selected
6097 (when (and even-window-heights 6107window is larger than WINDOW."
6098 ;; Even iff WINDOW forms a vertical combination with the 6108 (when (and (= (window-child-count (window-parent window)) 2)
6099 ;; selected window, and WINDOW's height exceeds that of the 6109 (eq (window-parent) (window-parent window)))
6100 ;; selected window, see also bug#11880. 6110 (cond
6101 (window-combined-p window) 6111 ((and (not (memq even-window-sizes '(nil height-only)))
6102 (= (window-child-count (window-parent window)) 2) 6112 (window-combined-p window t)
6103 (eq (window-parent) (window-parent window)) 6113 (> (window-total-width) (window-total-width window)))
6104 (> (window-total-height) (window-total-height window))) 6114 (condition-case nil
6105 ;; Don't throw an error if we can't even window heights for 6115 (enlarge-window
6106 ;; whatever reason. 6116 (/ (- (window-total-width window) (window-total-width)) 2) t)
6107 (condition-case nil 6117 (error nil)))
6108 (enlarge-window 6118 ((and (not (memq even-window-sizes '(nil width-only)))
6109 (/ (- (window-total-height window) (window-total-height)) 2)) 6119 (window-combined-p window)
6110 (error nil)))) 6120 (> (window-total-height) (window-total-height window)))
6121 (condition-case nil
6122 (enlarge-window
6123 (/ (- (window-total-height window) (window-total-height)) 2))
6124 (error nil))))))
6111 6125
6112(defun window--display-buffer (buffer window type &optional alist dedicated) 6126(defun window--display-buffer (buffer window type &optional alist dedicated)
6113 "Display BUFFER in WINDOW. 6127 "Display BUFFER in WINDOW.
@@ -6767,7 +6781,7 @@ that frame."
6767 6781
6768 (prog1 6782 (prog1
6769 (window--display-buffer buffer window 'reuse alist) 6783 (window--display-buffer buffer window 'reuse alist)
6770 (window--even-window-heights window) 6784 (window--even-window-sizes window)
6771 (unless (cdr (assq 'inhibit-switch-frame alist)) 6785 (unless (cdr (assq 'inhibit-switch-frame alist))
6772 (window--maybe-raise-frame (window-frame window))))))) 6786 (window--maybe-raise-frame (window-frame window)))))))
6773 6787