[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, origina
From: |
João Távora |
Subject: |
bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ) |
Date: |
Wed, 25 Oct 2017 14:19:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) |
martin rudalics <rudalics@gmx.at> writes:
>> * 0003-Allow-split-window-sensibly-to-split-threshold-in-fu.patch
>>
>> This extends the exception granted by split-window-sensibly to
>> single-window frames whose dimensions are below those of splitting
>> thresholds to consider multi-window frames where all but one window is
>> dedicated.
>
> Maybe the new behavior should be made customizable but this is for users
> of dedicated windows to decide.
>
Hmmm, adding a defcustom sounds a bit heavy-handed to me. We’re talking
about adding an option to preserve the behaviour of a failure. The
docstring would certainly be hard to phrase.
Perhaps we could just wait for the (quite improbable in my opinion)
complaints of dedicated window users that expected their split-window
operations to fail in certain extreme situations hence causing
(un)expected frames to pop up?
> In either case, instead of constructing
> ‘window-list’ please consider using ‘walk-window-tree’ for that part
Done. See attached patch.
João
>From eb1a0ce0c66502bee41c090afcb04c65271196a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= <joaotavora@gmail.com>
Date: Mon, 23 Oct 2017 09:05:32 +0100
Subject: [PATCH 3/4] 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 slightly expands on 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).
* 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.
---
lisp/window.el | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/lisp/window.el b/lisp/window.el
index c0a9ecd093..4814d12400 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6465,8 +6465,9 @@ split-height-threshold
vertically only if it has at least this many lines. If this is
nil, `split-window-sensibly' is not allowed to split a window
vertically. If, however, a window is the only window on its
-frame, `split-window-sensibly' may split it vertically
-disregarding the value of this variable."
+frame, or all the other ones are dedicated,
+`split-window-sensibly' may split it vertically disregarding the
+value of this variable."
:type '(choice (const nil) (integer :tag "lines"))
:version "23.1"
:group 'windows)
@@ -6573,15 +6574,27 @@ split-window-sensibly
;; Split window horizontally.
(with-selected-window window
(split-window-right)))
- (and (eq window (frame-root-window (window-frame window)))
- (not (window-minibuffer-p window))
- ;; If WINDOW is the only window on its frame and is not the
- ;; minibuffer window, try to split it vertically disregarding
- ;; the value of `split-height-threshold'.
- (let ((split-height-threshold 0))
- (when (window-splittable-p window)
- (with-selected-window window
- (split-window-below))))))))
+ (and
+ ;; If WINDOW is the only usable window on its frame (it is
+ ;; the only one or, not being the only one, all the other
+ ;; ones are dedicated) and is not the minibuffer window, try
+ ;; to split it vertically disregarding the value of
+ ;; `split-height-threshold'.
+ (let ((frame (window-frame window)))
+ (or
+ (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)
"Try to split WINDOW.
--
2.14.2
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), (continued)
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), João Távora, 2017/10/25
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), martin rudalics, 2017/10/26
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), Eli Zaretskii, 2017/10/26
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), Dmitry Gutov, 2017/10/26
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), João Távora, 2017/10/26
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), João Távora, 2017/10/26
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), Eli Zaretskii, 2017/10/28
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), João Távora, 2017/10/28
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), Dmitry Gutov, 2017/10/26
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), martin rudalics, 2017/10/25
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ),
João Távora <=
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), martin rudalics, 2017/10/26
- bug#28814: [BUMP, PATCH] (26.0.90; When *xref* window is needed, original window-switching intent is lost ), Dmitry Gutov, 2017/10/24