bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62592: Not creating new Tabs with small window


From: Juri Linkov
Subject: bug#62592: Not creating new Tabs with small window
Date: Wed, 17 May 2023 19:46:31 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>>>>> 3. resize the Emacs window to a small one, but large enough to show some 
>>>>> Tab labels
>>>>> 4. 1x click on rightmost * in the Tab Bar to create a new Tab
>>>>>     split-window: Window #<window 3 on*Messages*> too small for splitting
>>> -      (setq window (prog1 (split-window window)
>>> +      (setq window (prog1 (let ((window-min-height 1))
>>> +                            (split-window window))
>
> Split the window horizontally.  If a user can see the "+" button on the
> tab bar, the containing frame should be wide enough to accommodate two
> side-by-side windows.  Also it's always better to specify an explicit
> SIZE argument to make a small window than to bind 'window-min-height'.

Thanks for the suggestion.  Empirically I found that
'(split-window-horizontally 1)' always fails.
So the next patch uses '(split-window-horizontally 2)'.

> For Emacs 30 I'd recommend a new routine say 'clean-window' to make its
> argument window pristine.  The way you do it now loses all overlays with
> a window property in the window's buffer.

The purpose of this trick is to change window identity.  So maybe
a better name would be 'clone-window'?

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 9d703b5d048..43c24eb46ad 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1585,7 +1585,7 @@ tab-bar-new-tab-to
               (window-state-put (window-state-get))
             ;; Create a new window to get rid of old window parameters
             ;; (e.g. prev/next buffers) of old window.
-            (split-window) (delete-window))))
+            (split-window-horizontally 2) (delete-window))))
 
       (let ((buffer
              (if (and (functionp tab-bar-new-tab-choice)
diff --git a/lisp/window.el b/lisp/window.el
index aa7520f30fa..1b497254a02 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6391,7 +6391,7 @@ window-state-put
                      (selected-window)))
       (delete-other-windows-internal window root)
       ;; Create a new window to replace the existing one.
-      (setq window (prog1 (split-window window)
+      (setq window (prog1 (split-window-horizontally 2 window)
                      (delete-window window)))))
 
   (set-window-dedicated-p window nil)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]