GNU bug report logs - #62592
Not creating new Tabs with small window

Previous Next

Package: emacs;

Reported by: Claudio Grondi <claudio.grondi <at> freenet.de>

Date: Sat, 1 Apr 2023 12:49:02 UTC

Severity: normal

Fixed in version 29.0.60

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62592 in the body.
You can then email your comments to 62592 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Sat, 01 Apr 2023 12:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Claudio Grondi <claudio.grondi <at> freenet.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 01 Apr 2023 12:49:02 GMT) Full text and rfc822 format available.

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

From: Claudio Grondi <claudio.grondi <at> freenet.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Not creating new Tabs with small window
Date: Sat, 1 Apr 2023 14:48:40 +0200
1. ~ $ emacs -Q
2. Menu -> Options -> Show/Hide -> Tab Bar (gives Tab*scratch*)
3. resize the Emacs window to a small one, but large enough to show some Tab labels
3. 1x click on rightmost * in the Tab Bar to create a new Tab

The bug: No new Tab will be created and the minibuf and*Messages*  show:

   split-window: Window #<window 3 on*Messages*> too small for splitting

To: bug-gnu-emacs <at> gnu.org

Subject: 29.0.60; Not creating new Tabs with small window
--text follows this line--



In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2023-03-30 built on OoO
Repository revision: 4508a024e81834cfb01c6f7984182e1a6cbb91ea
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Linux Mint 21

Configured using:
 'configure --with-x-toolkit=lucid --with-imagemagick'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG LCMS2 LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM
LUCID ZLIB

Important settings:
  value of $LC_MONETARY: C.UTF-8
  value of $LC_NUMERIC: C.UTF-8
  value of $LC_TIME: C.UTF-8
  value of $LANG: C.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Messages

Minor modes in effect:
  shell-dirtrack-mode: t
  savehist-mode: t
  desktop-save-mode: t
  display-time-mode: t
  delete-selection-mode: t
  save-place-mode: t
  cua-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/neo/.emacs.d/elpa/svg-1.1/svg hides 
/usr/local/share/emacs/29.0.60/lisp/svg
/home/neo/.emacs.d/elpa/cl-lib-0.7.1/cl-lib hides 
/usr/local/share/emacs/29.0.60/lisp/emacs-lisp/cl-lib

Features:
(shadow sort mail-extr emacsbug message yank-media puny rfc822 mml
mml-sec epa derived epg rfc6068 epg-config gnus-util
text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils sh-script smie executable tramp-archive
tramp-gvfs tramp-cache time-stamp zeroconf dbus xml tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat shell pcomplete
parse-time iso8601 ls-lisp format-spec dired-aux dired dired-loaddefs
tab-line autorevert filenotify time-date python rx project pcase treesit
comint ansi-osc ring ansi-color nlinum linum finder-inf find-desktop
savehist desktop frameset time cl-extra help-mode icons delsel saveplace
cua-base cus-load moe-theme-autoloads system-packages-autoloads
rainbow-mode-autoloads paredit-autoloads info orderless-autoloads
mines-autoloads luwak-autoloads tiny-autoloads which-key-autoloads
transwin-autoloads edit-indirect-autoloads shell-command+-autoloads
dired-du-autoloads svg-autoloads svg-lib-autoloads
smooth-scroll-autoloads treeview-autoloads
ascii-art-to-unicode-autoloads vlf-autoloads smartparens-autoloads
grip-mode-autoloads wgrep-autoloads good-scroll-autoloads
sublimity-autoloads nlinum-autoloads elisp-slime-nav-autoloads
minimap-autoloads relint-autoloads xr-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty
make-network-process emacs)

Memory information:
((conses 16 232088 15236)
 (symbols 48 16510 0)
 (strings 32 76078 3220)
 (string-bytes 1 2024728)
 (vectors 16 28773)
 (vector-slots 8 437311 17063)
 (floats 8 89 182)
 (intervals 56 2531 813)
 (buffers 984 24))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Sun, 02 Apr 2023 07:03:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Claudio Grondi <claudio.grondi <at> freenet.de>
Cc: 62592 <at> debbugs.gnu.org
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Sun, 02 Apr 2023 09:52:31 +0300
> 1. ~ $ emacs -Q
> 2. Menu -> Options -> Show/Hide -> Tab Bar (gives Tab*scratch*)
> 3. resize the Emacs window to a small one, but large enough to show some Tab labels
> 3. 1x click on rightmost * in the Tab Bar to create a new Tab
>
> The bug: No new Tab will be created and the minibuf and*Messages*  show:
>
>    split-window: Window #<window 3 on*Messages*> too small for splitting

Thanks for the bug report.  It is related to bug#62427 where
we need to find a way to create a new window without using
delete-windows and split-window.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Sun, 02 Apr 2023 17:51:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Claudio Grondi <claudio.grondi <at> freenet.de>
Cc: 62592 <at> debbugs.gnu.org
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Sun, 02 Apr 2023 20:49:09 +0300
[Message part 1 (text/plain, inline)]
>> 1. ~ $ emacs -Q
>> 2. Menu -> Options -> Show/Hide -> Tab Bar (gives Tab*scratch*)
>> 3. resize the Emacs window to a small one, but large enough to show some Tab labels
>> 3. 1x click on rightmost * in the Tab Bar to create a new Tab
>>
>> The bug: No new Tab will be created and the minibuf and*Messages*  show:
>>
>>    split-window: Window #<window 3 on*Messages*> too small for splitting
>
> Thanks for the bug report.  It is related to bug#62427 where
> we need to find a way to create a new window without using
> delete-windows and split-window.

Oh, I noticed the same problem in window-state-put too :-(
Restoring window states fails with the same error in narrow windows.
However, here is a fix.  Eli, is it ok to fix this in emacs-29?

[split-window-window-min-height.patch (text/x-diff, inline)]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 35474e1c674..08f904ec73d 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1586,7 +1595,8 @@ 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))))
+            (let ((window-min-height 1)) (split-window))
+            (delete-window))))
 
       (let ((buffer
              (if (and (functionp tab-bar-new-tab-choice)
diff --git a/lisp/window.el b/lisp/window.el
index aa7520f30fa..b2ee869940a 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6391,7 +6396,8 @@ 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 (let ((window-min-height 1))
+                            (split-window window))
                      (delete-window window)))))
 
   (set-window-dedicated-p window nil)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Sun, 02 Apr 2023 18:03:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>, Benson Chu <bensonchu457 <at> fastmail.com>
Cc: 62592 <at> debbugs.gnu.org, claudio.grondi <at> freenet.de
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Sun, 02 Apr 2023 21:02:10 +0300
> Cc: 62592 <at> debbugs.gnu.org
> From: Juri Linkov <juri <at> linkov.net>
> Date: Sun, 02 Apr 2023 20:49:09 +0300
> 
> >> 1. ~ $ emacs -Q
> >> 2. Menu -> Options -> Show/Hide -> Tab Bar (gives Tab*scratch*)
> >> 3. resize the Emacs window to a small one, but large enough to show some Tab labels
> >> 3. 1x click on rightmost * in the Tab Bar to create a new Tab
> >>
> >> The bug: No new Tab will be created and the minibuf and*Messages*  show:
> >>
> >>    split-window: Window #<window 3 on*Messages*> too small for splitting
> >
> > Thanks for the bug report.  It is related to bug#62427 where
> > we need to find a way to create a new window without using
> > delete-windows and split-window.
> 
> Oh, I noticed the same problem in window-state-put too :-(
> Restoring window states fails with the same error in narrow windows.
> However, here is a fix.  Eli, is it ok to fix this in emacs-29?

Yes, although I cannot say I'm fond of such kludges.

(I thought Benson Chu was working on a better fix for these problems?)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Tue, 25 Apr 2023 17:38:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 62592 <at> debbugs.gnu.org, Benson Chu <bensonchu457 <at> fastmail.com>,
 claudio.grondi <at> freenet.de
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Tue, 25 Apr 2023 20:28:46 +0300
>> >> 1. ~ $ emacs -Q
>> >> 2. Menu -> Options -> Show/Hide -> Tab Bar (gives Tab*scratch*)
>> >> 3. resize the Emacs window to a small one, but large enough to show some Tab labels
>> >> 3. 1x click on rightmost * in the Tab Bar to create a new Tab
>> >>
>> >> The bug: No new Tab will be created and the minibuf and*Messages*  show:
>> >>
>> >>    split-window: Window #<window 3 on*Messages*> too small for splitting
>> >
>> > Thanks for the bug report.  It is related to bug#62427 where
>> > we need to find a way to create a new window without using
>> > delete-windows and split-window.
>>
>> Oh, I noticed the same problem in window-state-put too :-(
>> Restoring window states fails with the same error in narrow windows.
>> However, here is a fix.  Eli, is it ok to fix this in emacs-29?
>
> Yes, although I cannot say I'm fond of such kludges.
>
> (I thought Benson Chu was working on a better fix for these problems?)

After bug#62427 was closed, this bug is still reproducible.
The proposed patch remains the same.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Tue, 16 May 2023 17:48:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 62592 <at> debbugs.gnu.org
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Tue, 16 May 2023 20:34:32 +0300
>>> 1. ~ $ emacs -Q
>>> 2. Menu -> Options -> Show/Hide -> Tab Bar (gives Tab *scratch*)
>>> 3. resize the Emacs window to a small one, but large enough to show some Tab labels
>>> 3. 1x click on rightmost * in the Tab Bar to create a new Tab
>>>
>>> The bug: No new Tab will be created and the minibuf and*Messages*  show:
>>>
>>>    split-window: Window #<window 3 on*Messages*> too small for splitting
>>
>> Thanks for the bug report.  It is related to bug#62427 where
>> we need to find a way to create a new window without using
>> delete-windows and split-window.

The patch below still fails when the height of the window is 1 line.

Maybe Martin could help?

> diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
> index 35474e1c674..08f904ec73d 100644
> --- a/lisp/tab-bar.el
> +++ b/lisp/tab-bar.el
> @@ -1586,7 +1595,8 @@ 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))))
> +            (let ((window-min-height 1)) (split-window))
> +            (delete-window))))
>  
>        (let ((buffer
>               (if (and (functionp tab-bar-new-tab-choice)
> diff --git a/lisp/window.el b/lisp/window.el
> index aa7520f30fa..b2ee869940a 100644
> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -6391,7 +6396,8 @@ 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 (let ((window-min-height 1))
> +                            (split-window window))
>                       (delete-window window)))))
>  
>    (set-window-dedicated-p window nil)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Wed, 17 May 2023 07:08:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 62592 <at> debbugs.gnu.org
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Wed, 17 May 2023 09:07:21 +0200
>>>> 1. ~ $ emacs -Q
>>>> 2. Menu -> Options -> Show/Hide -> Tab Bar (gives Tab *scratch*)
>>>> 3. resize the Emacs window to a small one, but large enough to show some Tab labels
>>>> 3. 1x click on rightmost * in the Tab Bar to create a new Tab
>>>>
>>>> The bug: No new Tab will be created and the minibuf and*Messages*  show:
>>>>
>>>>     split-window: Window #<window 3 on*Messages*> too small for splitting
>>>
>>> Thanks for the bug report.  It is related to bug#62427 where
>>> we need to find a way to create a new window without using
>>> delete-windows and split-window.
>
> The patch below still fails when the height of the window is 1 line.
>
> Maybe Martin could help?
>
>> diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
>> index 35474e1c674..08f904ec73d 100644
>> --- a/lisp/tab-bar.el
>> +++ b/lisp/tab-bar.el
>> @@ -1586,7 +1595,8 @@ 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))))
>> +            (let ((window-min-height 1)) (split-window))
>> +            (delete-window))))
>>
>>         (let ((buffer
>>                (if (and (functionp tab-bar-new-tab-choice)
>> diff --git a/lisp/window.el b/lisp/window.el
>> index aa7520f30fa..b2ee869940a 100644
>> --- a/lisp/window.el
>> +++ b/lisp/window.el
>> @@ -6391,7 +6396,8 @@ 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 (let ((window-min-height 1))
>> +                            (split-window window))
>>                        (delete-window window)))))
>>
>>     (set-window-dedicated-p window nil)

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'.

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.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Wed, 17 May 2023 17:20:04 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 62592 <at> debbugs.gnu.org
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Wed, 17 May 2023 19:46:31 +0300
>>>>> 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)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Thu, 18 May 2023 08:31:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 62592 <at> debbugs.gnu.org
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Thu, 18 May 2023 10:30:12 +0200
> Thanks for the suggestion.  Empirically I found that
> '(split-window-horizontally 1)' always fails.
> So the next patch uses '(split-window-horizontally 2)'.

1 is less than 'window-safe-min-width' (the doc-string of 'split-window'
says in this regard that "this function can make a new window as small
as one line or two columns").  And are you sure you want to copy the
'quit-restore' parameter?  As a rule, in Lisp code never use the
-vertically/-horizontally postfixed forms of 'split-window' unless you
want to mock their interactive behavior.

>> 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'?

Funny - here I use that for a window that can shadow an existing window
for redisplay purposes.  If you want the selected window to change
identity, you should say that in a comment.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Thu, 18 May 2023 16:02:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 62592 <at> debbugs.gnu.org
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Thu, 18 May 2023 18:50:29 +0300
>> Thanks for the suggestion.  Empirically I found that
>> '(split-window-horizontally 1)' always fails.
>> So the next patch uses '(split-window-horizontally 2)'.
>
> 1 is less than 'window-safe-min-width' (the doc-string of 'split-window'
> says in this regard that "this function can make a new window as small
> as one line or two columns").  And are you sure you want to copy the
> 'quit-restore' parameter?  As a rule, in Lisp code never use the
> -vertically/-horizontally postfixed forms of 'split-window' unless you
> want to mock their interactive behavior.

Then the following patch seems the right way to implement this.

>>> 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'?
>
> Funny - here I use that for a window that can shadow an existing window
> for redisplay purposes.  If you want the selected window to change
> identity, you should say that in a comment.

Actually, there are 2 cases:

1. when 'tab-bar-new-tab-choice' is not equal to 'window'
   then need to remove all old window parameters and
   create a new window, this is what split-window/delete-window do;

2. when 'tab-bar-new-tab-choice' is 'window', then need to create
   a new identity that keeps all window parameters, this is done by:
   (window-state-put (window-state-get))
   And comments are trying to explain this.

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 9d703b5d048..aae80b28047 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1585,7 +1585,8 @@ 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 nil window-safe-min-width t)
+            (delete-window))))
 
       (let ((buffer
              (if (and (functionp tab-bar-new-tab-choice)
diff --git a/lisp/window.el b/lisp/window.el
index aa7520f30fa..ab7dd5ced12 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 window window-safe-min-width t)
                      (delete-window window)))))
 
   (set-window-dedicated-p window nil)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Fri, 19 May 2023 07:32:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 62592 <at> debbugs.gnu.org
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Fri, 19 May 2023 09:31:12 +0200
> Then the following patch seems the right way to implement this.

LGTM

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62592; Package emacs. (Fri, 19 May 2023 18:17:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 62592 <at> debbugs.gnu.org
Subject: Re: bug#62592: Not creating new Tabs with small window
Date: Fri, 19 May 2023 21:04:58 +0300
close 62592 29.0.60
thanks

>> Then the following patch seems the right way to implement this.
>
> LGTM

So now pushed to emacs-29, and closed.




bug marked as fixed in version 29.0.60, send any further explanations to 62592 <at> debbugs.gnu.org and Claudio Grondi <claudio.grondi <at> freenet.de> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Fri, 19 May 2023 18:17:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 17 Jun 2023 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 313 days ago.

Previous Next


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