From: joaotavora@gmail.com (João Távora)
To: martin rudalics <rudalics@gmx.at>
Cc: 28814@debbugs.gnu.org, Dmitry Gutov <dgutov@yandex.ru>
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 [thread overview]
Message-ID: <87wp3js6u9.fsf@gmail.com> (raw)
In-Reply-To: <59F0413F.8010100@gmx.at> (martin rudalics's message of "Wed, 25 Oct 2017 09:46:07 +0200")
[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-Allow-split-window-sensibly-to-split-threshold-in-fu.patch --]
[-- Type: text/x-diff, Size: 3288 bytes --]
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
next prev parent reply other threads:[~2017-10-25 13:19 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 16:07 bug#28814: 26.0.90; When *xref* window is needed, original window-switching intent is lost João Távora
[not found] ` <handler.28814.B.150791088020837.ack@debbugs.gnu.org>
2017-10-16 17:58 ` bug#28814: Acknowledgement (26.0.90; When *xref* window is needed, original window-switching intent is lost ) João Távora
2017-10-20 9:13 ` bug#28814: [BUMP, PATCH] " João Távora
2017-10-20 10:39 ` Dmitry Gutov
2017-10-23 2:06 ` Dmitry Gutov
2017-10-23 8:23 ` João Távora
2017-10-23 20:03 ` João Távora
2017-10-25 0:24 ` Dmitry Gutov
2017-10-25 7:43 ` João Távora
2017-10-25 10:24 ` Dmitry Gutov
2017-10-25 13:29 ` João Távora
2017-10-25 14:49 ` Dmitry Gutov
2017-10-25 15:35 ` João Távora
2017-10-25 15:46 ` Dmitry Gutov
2017-10-25 15:11 ` Eli Zaretskii
2017-10-25 15:27 ` João Távora
2017-10-25 15:39 ` Eli Zaretskii
2017-10-25 20:56 ` João Távora
2017-10-26 7:56 ` martin rudalics
2017-10-26 16:42 ` Eli Zaretskii
2017-10-26 22:40 ` Dmitry Gutov
2017-10-27 0:05 ` João Távora
2017-11-02 17:06 ` Dmitry Gutov
2017-10-26 23:59 ` João Távora
2017-10-28 9:41 ` Eli Zaretskii
2017-10-28 19:19 ` João Távora
2017-11-02 17:03 ` João Távora
2017-11-02 17:07 ` Eli Zaretskii
2017-11-02 19:07 ` João Távora
2017-11-02 19:32 ` Eli Zaretskii
2017-11-03 13:47 ` Eli Zaretskii
2017-11-03 16:18 ` João Távora
2017-11-03 19:06 ` Eli Zaretskii
2017-10-26 12:39 ` Dmitry Gutov
2017-10-25 7:46 ` martin rudalics
2017-10-25 13:19 ` João Távora [this message]
2017-10-26 7:56 ` martin rudalics
2017-10-25 0:07 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wp3js6u9.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=28814@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).