Allow split-window-sensibly to split threshold in further edge case
As a fallback, and to avoid creating a frame, split-window-sensibly would previously disregard split-height-threshold if the window to be split is the frame's root window. This change generalizes that: it disregards the threshold if the window to be split is the frame's only _usable_ window (it is either the only one, as before, or all the other windows are dedicated to some buffer and thus cannot be touched). This is required for the fix to bug#28814. * lisp/window.el (split-height-threshold): Adjust doc to match split-window-sensibly. (split-window-sensibly): Also disregard threshold if all other windows are dedicated.
This commit is contained in:
parent
2a973edeac
commit
5d34e1b288
1 changed files with 24 additions and 11 deletions
|
@ -6465,8 +6465,9 @@ If this is an integer, `split-window-sensibly' may split a window
|
||||||
vertically only if it has at least this many lines. If this is
|
vertically only if it has at least this many lines. If this is
|
||||||
nil, `split-window-sensibly' is not allowed to split a window
|
nil, `split-window-sensibly' is not allowed to split a window
|
||||||
vertically. If, however, a window is the only window on its
|
vertically. If, however, a window is the only window on its
|
||||||
frame, `split-window-sensibly' may split it vertically
|
frame, or all the other ones are dedicated,
|
||||||
disregarding the value of this variable."
|
`split-window-sensibly' may split it vertically disregarding the
|
||||||
|
value of this variable."
|
||||||
:type '(choice (const nil) (integer :tag "lines"))
|
:type '(choice (const nil) (integer :tag "lines"))
|
||||||
:version "23.1"
|
:version "23.1"
|
||||||
:group 'windows)
|
:group 'windows)
|
||||||
|
@ -6573,15 +6574,27 @@ split."
|
||||||
;; Split window horizontally.
|
;; Split window horizontally.
|
||||||
(with-selected-window window
|
(with-selected-window window
|
||||||
(split-window-right)))
|
(split-window-right)))
|
||||||
(and (eq window (frame-root-window (window-frame window)))
|
(and
|
||||||
(not (window-minibuffer-p window))
|
;; If WINDOW is the only usable window on its frame (it is
|
||||||
;; If WINDOW is the only window on its frame and is not the
|
;; the only one or, not being the only one, all the other
|
||||||
;; minibuffer window, try to split it vertically disregarding
|
;; ones are dedicated) and is not the minibuffer window, try
|
||||||
;; the value of `split-height-threshold'.
|
;; to split it vertically disregarding the value of
|
||||||
(let ((split-height-threshold 0))
|
;; `split-height-threshold'.
|
||||||
(when (window-splittable-p window)
|
(let ((frame (window-frame window)))
|
||||||
(with-selected-window window
|
(or
|
||||||
(split-window-below))))))))
|
(eq window (frame-root-window frame))
|
||||||
|
(catch 'done
|
||||||
|
(walk-window-tree (lambda (w)
|
||||||
|
(unless (or (eq w window)
|
||||||
|
(window-dedicated-p w))
|
||||||
|
(throw 'done nil)))
|
||||||
|
frame)
|
||||||
|
t)))
|
||||||
|
(not (window-minibuffer-p window))
|
||||||
|
(let ((split-height-threshold 0))
|
||||||
|
(when (window-splittable-p window)
|
||||||
|
(with-selected-window window
|
||||||
|
(split-window-below))))))))
|
||||||
|
|
||||||
(defun window--try-to-split-window (window &optional alist)
|
(defun window--try-to-split-window (window &optional alist)
|
||||||
"Try to split WINDOW.
|
"Try to split WINDOW.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue