From: "Benson Chu" <bensonchu457@fastmail.com>
To: "Eli Zaretskii" <eliz@gnu.org>, "Juri Linkov" <juri@linkov.net>
Cc: 62427@debbugs.gnu.org
Subject: bug#62427: tab-bar-new-tab-to now handles cases with multiple side-windows
Date: Mon, 27 Mar 2023 12:43:31 -0500 [thread overview]
Message-ID: <e622b89c-cc8e-4451-aeaa-88f5ee828f2e@app.fastmail.com> (raw)
In-Reply-To: <83sfdq86pi.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1912 bytes --]
Oops, I only replied to Eli. I'll send my explanation, and new patch.
> When the variable tab-bar-new-tab-choice is set to t, the intended
> behavior is to create a new tab with a single window, and that single
> window displaying the current buffer of the currently selected window,
> and the new window should have a fresh set of window parameters.
> Typically, this is done by first calling delete-other-windows, so the
> currently selected window is the only window. The call to
> delete-other-windows also ignores window-parameters, so even windows
> that have the no-delete-other-windows parameter still get deleted. Then,
> the current window is split, to create a fresh new window with fresh
> window parameters, and then delete-window is called to delete the
> currently selected window.
> This strategy doesn't work when the current window is a side-window,
> because delete-other-windows has a check which says that a side-window
> cannot be the only window in a frame. So, to work around this, we just
> remove the window-side parameter beforehand, so the above strategy still
> works.
> Another way we could do this was to get the current-buffer, then delete
> all side-windows. After deleting all side-windows, we know the current
> selected window is NOT a side-window, and then we can call
> delete-other-windows, split-window, and delete-window.
On Mon, Mar 27, 2023, at 12:06 PM, Eli Zaretskii wrote:
>> From: Juri Linkov <juri@linkov.net>
>> Cc: bensonchu457@fastmail.com, 62427@debbugs.gnu.org
>> Date: Mon, 27 Mar 2023 19:39:25 +0300
>>
>> > Maybe I'll agree, but I still don't understand the problem well
>> > enough. Would you please explain the original problem that led
>> > tab-bar.el to care about these window parameters?
>>
>> Sorry, I can't explain. I just did that Martin said to do
>> in bug#53662.
>
> That's okay, Benson Chu explained it.
>
> Let me think about this.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-tab-bar-new-tab-now-handles-multiple-side-windows.patch --]
[-- Type: text/x-patch; name="0001-tab-bar-new-tab-now-handles-multiple-side-windows.patch", Size: 2176 bytes --]
From 9596fe47f899c77567f4051990add7a31c8718aa Mon Sep 17 00:00:00 2001
From: Benson Chu <bensonchu457@gmail.com>
Date: Fri, 24 Mar 2023 15:38:03 -0500
Subject: [PATCH] ; tab-bar-new-tab now handles multiple side-windows
; Previously, calling tab-bar-new-tab-to only removes the 'window-side
; property on the currently selected window, and then a call to
; delete-other-windows was made to ensure that the selected window was
; the only window.
; However, if there are other side-windows (with the same side)
; present, the call to delete-other-windows will fail on the
; window--sides-check. This is because according to the check, all
; windows on the same side should have the same 'window-side, and
; because we only removed the 'window-side parameters on one of the
; windows, there will be inconsistencies with that window and its
; parent and siblings. Because of this, the call to
; delete-other-windows to fail.
; This patch makes sure that all windows on a given side will have
; 'window-side set to nil, so that the call to delete-other-windows
; will not fail.
* lisp/tab-bar.el (tab-bar-new-tab-to): remove 'window-side
from selected window, window's parent, and all window's
siblings.
Copyright-paperwork-exempt: yes
---
lisp/tab-bar.el | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index dce6fa735fc..f05abffbcdb 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1556,7 +1556,13 @@ tab-bar-new-tab-to
;; with `delete-other-windows' and `split-window'.
(unless (eq tab-bar-new-tab-choice 'clone)
(set-window-parameter nil 'window-atom nil)
- (set-window-parameter nil 'window-side nil))
+ (let ((side (window-parameter nil 'window-side)))
+ (when side
+ (walk-window-tree
+ (lambda (window)
+ (when (eq side (window-parameter window 'window-side))
+ (set-window-parameter window 'window-side nil)))
+ nil t))))
(let ((ignore-window-parameters t))
(if (eq tab-bar-new-tab-choice 'clone)
;; Create new unique windows with the same layout
--
2.40.0
next prev parent reply other threads:[~2023-03-27 17:43 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 21:07 bug#62427: tab-bar-new-tab-to now handles cases with multiple side-windows Benson Chu
2023-03-25 19:14 ` Juri Linkov
2023-03-26 4:19 ` Eli Zaretskii
2023-03-27 7:05 ` Juri Linkov
2023-03-27 13:36 ` Eli Zaretskii
2023-03-27 16:39 ` Juri Linkov
2023-03-27 17:06 ` Eli Zaretskii
2023-03-27 17:43 ` Benson Chu [this message]
2023-03-28 12:42 ` Eli Zaretskii
2023-03-28 16:17 ` Benson Chu
2023-03-28 17:11 ` Eli Zaretskii
2023-03-28 17:39 ` Benson Chu
2023-03-30 16:43 ` Juri Linkov
2023-03-31 16:20 ` Benson Chu
2023-04-01 18:25 ` Juri Linkov
2023-04-02 18:20 ` Juri Linkov
2023-04-02 18:51 ` Juri Linkov
2023-04-15 3:03 ` Benson Chu
2023-04-15 18:42 ` Juri Linkov
2023-04-18 6:58 ` Juri Linkov
2023-04-22 9:05 ` Eli Zaretskii
2023-04-23 16:39 ` Juri Linkov
2023-04-24 11:50 ` Eli Zaretskii
2023-04-25 17:25 ` Juri Linkov
2023-05-15 17:32 ` Juri Linkov
2023-04-25 17:30 ` Juri Linkov
2023-05-16 17:32 ` Juri Linkov
2023-05-16 17:52 ` Juri Linkov
2023-05-17 8:13 ` martin rudalics
2023-05-17 16:39 ` Juri Linkov
2023-05-18 8:31 ` martin rudalics
2023-05-18 15:46 ` Juri Linkov
2023-05-19 7:31 ` martin rudalics
2023-05-19 18:14 ` Juri Linkov
2023-05-16 18:23 ` Eli Zaretskii
2023-05-17 16:32 ` Juri Linkov
2023-05-17 17:24 ` Eli Zaretskii
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=e622b89c-cc8e-4451-aeaa-88f5ee828f2e@app.fastmail.com \
--to=bensonchu457@fastmail.com \
--cc=62427@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=juri@linkov.net \
/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).