GNU bug report logs - #53662
29.0.50; Cannot use tab-new from side window

Previous Next

Package: emacs;

Reported by: Aaron Jensen <aaronjensen <at> gmail.com>

Date: Mon, 31 Jan 2022 15:26:01 UTC

Severity: normal

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 53662 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 53662 <at> debbugs.gnu.org, Aaron Jensen <aaronjensen <at> gmail.com>
Subject: Re: bug#53662: 29.0.50; Cannot use tab-new from side window
Date: Tue, 01 Feb 2022 21:31:56 +0200
[Message part 1 (text/plain, inline)]
>> Martin, could you suggest how to ignore window-sideness
>> while splitting the side window?  'tab-bar-new-tab-to'
>> currently uses such trick to create a new window:
>>
>>        (let ((ignore-window-parameters t))
>>          (delete-other-windows))
>
> Usually, you can't make a side window the only window on its frame - the
> main window has to stay.  If you ignore window parameters, you have to
> clean the state of windows yourself afterwards - for example, by giving
> the sole remaining window a 'window-side' parameter of nil.  If you do
> not do that, the windows state of the frame is broken already before you
> try splitting the window below.
>
>>        (unless (eq tab-bar-new-tab-choice 'window)
>>          ;; Create a new window to get rid of old window parameters
>>          ;; (e.g. prev/next buffers) of old window.
>>          (split-window) (delete-window))
>>
>> but this fails in side windows.
>
> This is a hack and would fail in the case at hand since 'split-window'
> would set the 'window-side' parameter for the new window.  I'd rather
> set all parameters of the selected window to nil instead.

Thanks, I confirm this fixes the problem with this patch.
Also ‘split-window’ and ‘delete-window’ were moved
inside ‘(ignore-window-parameters t)’ for more safety:

[tab-new-window-parameters.patch (text/x-diff, inline)]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 06ad8f60af..43a56c806b 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1361,12 +1361,17 @@ 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 all window parameters to prevent the case
+      ;; when e.g. `window-side' gets in the way.
+      (dolist (parameter (window-parameters))
+        (set-window-parameter nil (car parameter) nil))
       (let ((ignore-window-parameters t))
-        (delete-other-windows))
-      (unless (eq tab-bar-new-tab-choice 'window)
-        ;; Create a new window to get rid of old window parameters
-        ;; (e.g. prev/next buffers) of old window.
-        (split-window) (delete-window))
+        (delete-other-windows)
+        (unless (eq tab-bar-new-tab-choice 'window)
+          ;; Create a new window to get rid of old window parameters
+          ;; (e.g. prev/next buffers) of old window.
+          (split-window) (delete-window)))
+
       (let ((buffer
              (if (functionp tab-bar-new-tab-choice)
                  (funcall tab-bar-new-tab-choice)

This bug report was last modified 3 years and 160 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.