unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* tab-bar: Making a new tab without no-delete-other-windows windows
@ 2021-09-24  6:35 Adam Porter
  2021-09-24  6:50 ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Porter @ 2021-09-24  6:35 UTC (permalink / raw)
  To: emacs-devel

Hi Juri, et al,

I've been experimenting with tab-bar, and I noticed that, when I make a
new tab, e.g. with "C-x t 2", any windows that have the
no-delete-other-windows parameter set are displayed in the new tab.

I guess sometimes that might be what's desired, e.g. when using a side
window that the user wants to be displayed regardless of window
configuration.  But in my case, I have some side windows in a tab that
are only relevant to that tab's purpose, and when I make a new tab, I
don't want those side windows to be included in it.  As it is, I have to
"C-x 0" on each unwanted window after making the new tab, which is
awkward.

So I added this to my config, which seems to solve it for me:

  (use-package tab-bar
    :config
    (defun ap/really-delete-other-windows (&rest _ignore)
      (let ((ignore-window-parameters t))
        (delete-other-windows)))
    (cl-pushnew #'ap/really-delete-other-windows
                tab-bar-tab-post-open-functions))

I wonder, would it be worth including something like this by default, or
as a "batteries-included" choice in the customization option?

--
Thanks,
Adam




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: tab-bar: Making a new tab without no-delete-other-windows windows
  2021-09-24  6:35 tab-bar: Making a new tab without no-delete-other-windows windows Adam Porter
@ 2021-09-24  6:50 ` Juri Linkov
  2021-09-24  7:12   ` Adam Porter
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2021-09-24  6:50 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-devel

> I've been experimenting with tab-bar, and I noticed that, when I make a
> new tab, e.g. with "C-x t 2", any windows that have the
> no-delete-other-windows parameter set are displayed in the new tab.
>
> I guess sometimes that might be what's desired, e.g. when using a side
> window that the user wants to be displayed regardless of window
> configuration.  But in my case, I have some side windows in a tab that
> are only relevant to that tab's purpose, and when I make a new tab, I
> don't want those side windows to be included in it.  As it is, I have to
> "C-x 0" on each unwanted window after making the new tab, which is
> awkward.
>
> So I added this to my config, which seems to solve it for me:
>
>   (use-package tab-bar
>     :config
>     (defun ap/really-delete-other-windows (&rest _ignore)
>       (let ((ignore-window-parameters t))
>         (delete-other-windows)))
>     (cl-pushnew #'ap/really-delete-other-windows
>                 tab-bar-tab-post-open-functions))
>
> I wonder, would it be worth including something like this by default, or
> as a "batteries-included" choice in the customization option?

If this works for you, then maybe we need to include the same fix by default?

```
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 69eb3a3608..55a19db8bb 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1245,7 +1245,8 @@ 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)))
-      (delete-other-windows)
+      (let ((ignore-window-parameters t))
+        (delete-other-windows))
       ;; Create a new window to get rid of old window parameters
       ;; (e.g. prev/next buffers) of old window.
       (split-window) (delete-window)
```



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: tab-bar: Making a new tab without no-delete-other-windows windows
  2021-09-24  6:50 ` Juri Linkov
@ 2021-09-24  7:12   ` Adam Porter
  2021-09-25 19:25     ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Porter @ 2021-09-24  7:12 UTC (permalink / raw)
  To: emacs-devel

Juri Linkov <juri@linkov.net> writes:

>> I've been experimenting with tab-bar, and I noticed that, when I make a
>> new tab, e.g. with "C-x t 2", any windows that have the
>> no-delete-other-windows parameter set are displayed in the new tab.
>>
>> I guess sometimes that might be what's desired, e.g. when using a side
>> window that the user wants to be displayed regardless of window
>> configuration.  But in my case, I have some side windows in a tab that
>> are only relevant to that tab's purpose, and when I make a new tab, I
>> don't want those side windows to be included in it.  As it is, I have to
>> "C-x 0" on each unwanted window after making the new tab, which is
>> awkward.
>>
>> So I added this to my config, which seems to solve it for me:
>>
>>   (use-package tab-bar
>>     :config
>>     (defun ap/really-delete-other-windows (&rest _ignore)
>>       (let ((ignore-window-parameters t))
>>         (delete-other-windows)))
>>     (cl-pushnew #'ap/really-delete-other-windows
>>                 tab-bar-tab-post-open-functions))
>>
>> I wonder, would it be worth including something like this by default, or
>> as a "batteries-included" choice in the customization option?
>
> If this works for you, then maybe we need to include the same fix by default?
>
> ```
> diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
> index 69eb3a3608..55a19db8bb 100644
> --- a/lisp/tab-bar.el
> +++ b/lisp/tab-bar.el
> @@ -1245,7 +1245,8 @@ 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)))
> -      (delete-other-windows)
> +      (let ((ignore-window-parameters t))
> +        (delete-other-windows))
>        ;; Create a new window to get rid of old window parameters
>        ;; (e.g. prev/next buffers) of old window.
>        (split-window) (delete-window)
> ```

For myself, I have no objection to that.  :)  But I could imagine that
some users might sometimes have a side window that they would want to
persist when making a new tab; in that case, I guess that change would
prevent them from doing that.  Then again, that might be very rare,
considering how uncommon it seems to be to use dedicated side windows,
in general.  So I don't know what would be best.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: tab-bar: Making a new tab without no-delete-other-windows windows
  2021-09-24  7:12   ` Adam Porter
@ 2021-09-25 19:25     ` Juri Linkov
  2021-09-26  0:15       ` Adam Porter
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2021-09-25 19:25 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-devel

>> @@ -1245,7 +1245,8 @@ 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)))
>> -      (delete-other-windows)
>> +      (let ((ignore-window-parameters t))
>> +        (delete-other-windows))
>>        ;; Create a new window to get rid of old window parameters
>>        ;; (e.g. prev/next buffers) of old window.
>>        (split-window) (delete-window)
>
> For myself, I have no objection to that.  :)  But I could imagine that
> some users might sometimes have a side window that they would want to
> persist when making a new tab; in that case, I guess that change would
> prevent them from doing that.  Then again, that might be very rare,
> considering how uncommon it seems to be to use dedicated side windows,
> in general.  So I don't know what would be best.

In such case the users can duplicate the current tab that will keep
all dedicated side windows.  So now pushed this change.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: tab-bar: Making a new tab without no-delete-other-windows windows
  2021-09-25 19:25     ` Juri Linkov
@ 2021-09-26  0:15       ` Adam Porter
  0 siblings, 0 replies; 5+ messages in thread
From: Adam Porter @ 2021-09-26  0:15 UTC (permalink / raw)
  To: emacs-devel

Juri Linkov <juri@linkov.net> writes:

>>> @@ -1245,7 +1245,8 @@ 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)))
>>> -      (delete-other-windows)
>>> +      (let ((ignore-window-parameters t))
>>> +        (delete-other-windows))
>>>        ;; Create a new window to get rid of old window parameters
>>>        ;; (e.g. prev/next buffers) of old window.
>>>        (split-window) (delete-window)
>>
>> For myself, I have no objection to that.  :)  But I could imagine that
>> some users might sometimes have a side window that they would want to
>> persist when making a new tab; in that case, I guess that change would
>> prevent them from doing that.  Then again, that might be very rare,
>> considering how uncommon it seems to be to use dedicated side windows,
>> in general.  So I don't know what would be best.
>
> In such case the users can duplicate the current tab that will keep
> all dedicated side windows.  So now pushed this change.

Ah, great, thanks.  Emacs 28 is going to be a great step forward in many
ways.  :)




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-26  0:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24  6:35 tab-bar: Making a new tab without no-delete-other-windows windows Adam Porter
2021-09-24  6:50 ` Juri Linkov
2021-09-24  7:12   ` Adam Porter
2021-09-25 19:25     ` Juri Linkov
2021-09-26  0:15       ` Adam Porter

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