[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#46904: Non-unique windows produced by window-state-put
From: |
Juri Linkov |
Subject: |
bug#46904: Non-unique windows produced by window-state-put |
Date: |
Thu, 04 Mar 2021 19:57:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>>> It couldn't
>>> possibly harm unless the root window is too small to get split and we
>>> want to put only one window there; so we should handle that special case.
>>
>> I'll try this, thanks.
>
> I'd first try a vertical, then a horizontal split. Give up if both
> fail.
Maybe something like this:
diff --git a/lisp/window.el b/lisp/window.el
index cfd9876ed0..d750e16626 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6229,10 +6229,15 @@ window-state-put
(throw 'live window)))
root))
(selected-window)))
- (delete-other-windows-internal window root)
- ;; Create a new window to replace the existing one.
- (setq window (prog1 (split-window window)
- (delete-window window)))))
+ (delete-other-windows-internal window root)))
+
+ ;; Create a new window to replace the existing one.
+ (let ((new-window
+ (or (ignore-errors (split-window (selected-window)))
+ (ignore-errors (split-window (selected-window) nil t)))))
+ (when new-window
+ (delete-window window)
+ (setq window new-window)))
(set-window-dedicated-p window nil)
- bug#46904: Non-unique windows produced by window-state-put, Juri Linkov, 2021/03/03
- bug#46904: Non-unique windows produced by window-state-put, martin rudalics, 2021/03/04
- bug#46904: Non-unique windows produced by window-state-put, Juri Linkov, 2021/03/04
- bug#46904: Non-unique windows produced by window-state-put, martin rudalics, 2021/03/04
- bug#46904: Non-unique windows produced by window-state-put,
Juri Linkov <=
- bug#46904: Non-unique windows produced by window-state-put, Juri Linkov, 2021/03/04
- bug#46904: Non-unique windows produced by window-state-put, martin rudalics, 2021/03/05
- bug#46904: Non-unique windows produced by window-state-put, Juri Linkov, 2021/03/07
- bug#46904: Non-unique windows produced by window-state-put, martin rudalics, 2021/03/08
- bug#46904: Non-unique windows produced by window-state-put, Juri Linkov, 2021/03/08
- bug#46904: Non-unique windows produced by window-state-put, martin rudalics, 2021/03/08
- bug#46904: Non-unique windows produced by window-state-put, Juri Linkov, 2021/03/08
- bug#46904: Non-unique windows produced by window-state-put, Juri Linkov, 2021/03/09