all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Benson Chu <bensonchu457@fastmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: Eli Zaretskii <eliz@gnu.org>, 62427@debbugs.gnu.org
Subject: bug#62427: tab-bar-new-tab-to now handles cases with multiple side-windows
Date: Fri, 14 Apr 2023 22:03:34 -0500	[thread overview]
Message-ID: <87r0slbzqp.fsf@fastmail.com> (raw)
In-Reply-To: <86lejajex8.fsf@mail.linkov.net>

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

I've done some digging into whether we can mimic OR use display-buffer
when creating a new tab, and while we could do this, we also advertise
two other behaviors for tab-bar-new-tab-choice that would make the
function needlessly complex, as use/mimicry of display-buffer would only
help in the case of when tab-bar-new-tab-choice is t.

On a side-note (side-window? haha), I've got a patch that side-steps
(hehe) the issue of modifying the 'window-side parameter completely, by
binding to window--sides-inhibit-check to t.

Having bound this, the issues wrt split-window and delete-other-windows
is no longer present, and thus we no longer have to touch the
'window-side parameter at all.

The same can't be said for the 'window-atom parameter (there's no
variable to bind to ignore checks), so it still needs to be removed in
order to ensure a safe call to delete-other-windows and split-window.

Would this be a better patch? It's now less destructive on existing
window parameters.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-tab-bar-new-tab-inhibit-side-window-checks.patch --]
[-- Type: text/x-patch, Size: 1947 bytes --]

From 2eaeea1f815b5e6c75947e9373c1b2f8fc539344 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 inhibit side-window checks

; 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. We can skip this check by shadowing
; window--sides-inhibit-check to t.

* lisp/tab-bar.el (tab-bar-new-tab-to): inhibit side-window checks

Copyright-paperwork-exempt: yes
---
 lisp/tab-bar.el | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index dce6fa735fc..c7983146bf9 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1552,15 +1552,14 @@ tab-bar-new-tab-to
       ;; Handle the case when it's called in the active minibuffer.
       (when (minibuffer-selected-window)
         (select-window (minibuffer-selected-window)))
-      ;; Remove window parameters that can cause problems
-      ;; 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 ((ignore-window-parameters t))
+      (let ((ignore-window-parameters t)
+            (window--sides-inhibit-check t))
         (if (eq tab-bar-new-tab-choice 'clone)
             ;; Create new unique windows with the same layout
             (window-state-put (window-state-get))
+          ;; Remove window parameters that can cause problems
+          ;; with `delete-other-windows' and `split-window'.
+          (set-window-parameter nil 'window-atom nil)
           (delete-other-windows)
           (if (eq tab-bar-new-tab-choice 'window)
               ;; Create new unique window from remaining window
-- 
2.40.0


[-- Attachment #3: Type: text/plain, Size: 1319 bytes --]


Juri Linkov <juri@linkov.net> writes:

>> 1. (setq debug-on-error t enable-recursive-minibuffers t)
>> 2. M-:   (or any other prompt like 'M-x')
>> 3. Resize the minibuffer window e.g. with the mouse to at least 4 lines high
>> 4. M-x windmove-swap-states-up RET
>> 5. Click on the bottom window
>> 6. C-x t 2
>> 7. Click on the bottom window
>> 8. C-x t 2
>>
>> Debugger entered--Lisp error: (error "Specified root is not an ancestor of specified win...")
>>   delete-other-windows-internal(#<window 4 on *scratch*> #<window 7 on  *Minibuf-1*>)
>>   delete-other-windows()
>>   tab-bar-new-tab-to()
>>   tab-new(nil)
>
> Maybe the simplest fix is just not to create such a broken
> window configuration:
>
> diff --git a/lisp/windmove.el b/lisp/windmove.el
> index 06ce16c0d42..57511291588 100644
> --- a/lisp/windmove.el
> +++ b/lisp/windmove.el
> @@ -724,6 +724,8 @@ windmove-swap-states-in-direction
>                                             nil windmove-wrap-around 'nomini)))
>      (cond ((or (null other-window) (window-minibuffer-p other-window))
>             (user-error "No window %s from selected window" dir))
> +          ((window-minibuffer-p (selected-window))
> +           (user-error "Selected window is the minibuffer"))
>            (t
>             (window-swap-states nil other-window)))))

  reply	other threads:[~2023-04-15  3:03 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
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 [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0slbzqp.fsf@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.