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

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

bug#38354: 27.0.50; Implement display action display-buffer-in-tab


From: Juri Linkov
Subject: bug#38354: 27.0.50; Implement display action display-buffer-in-tab
Date: Fri, 29 Nov 2019 01:02:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>>    (tab-bar-buffer-visible-in-tabs-p buffer)
>
> But this may also return non-nil when the buffer is invisible, that is
> not shown in any window.  We already have the "visible frames"
> notation, including the non-obscured frames connotation, so I'd rather
> not use the term visible in the context of tabs.

Maybe like having the terms "visible frame" and "iconified frame",
we should use the terms "current tab" and "inactive tabs".

> Wouldn't something like 'tab-bar-buffer-present-in-tabs-p' or
> 'tab-bar-buffer-in-tabs-p' be more intuitive?

Instead of suffix '-p' that assumes the function returns a boolean value,
better to return the found tab with the function name 'tab-bar-buffer-in-tab'.

>>> - to say that a buffer is actually displayed on a frame that has a
>>>    tab-bar.
>>
>> In my code I use for this:
>>
>>    (>= (length (get-buffer-window-list buffer t t)) 1)
>
> Why not simply 'get-buffer-window'?

Because actually I used more complicated logic:

  (> (length (get-buffer-window-list buffer t t)) 1)

that means don't kill the current buffer if it's also displayed
somewhere else.

> In either case what does the above "displayed" in
>
>>>> to display the buffer in an existing tab if such buffer is
>>>> already displayed in it.
>
> refer to now?  The former, the latter or their
>
>> i.e. I check these situations differently, and use 'or'
>> to combine these conditions:
>>
>>    (or (>= (length (get-buffer-window-list buffer t t)) 1)
>>        (tab-bar-buffer-visible-in-tabs-p buffer))
>>
>> Should these conditions be combined in one function
>> (if the current tab can be considered a tab as well)?
>
> 'or'?

Anyway it seems better not to use the word "displayed".

>>> And why "tabs" indiscriminately?  Don't you ever want to check for
>>> presence or visibility in a specific tab only?
>>
>> A specific tab referred by name?  Maybe such function could be useful as 
>> well.
>
> Don't you ever want to discriminate the tabs of the selected frame
> from the tabs of other frames?  Or are they all the same?

This means we need to add another dimension: first to look for the buffer
in all tabs of the selected frame, then look in tabs of other frames:
visible, iconified, or on any frame.

>>> 'display-buffer-reuse-window' together with 'reusable-frames' should
>>> have all the ingredients for this.  What is missing?
>>
>> Than we need to add 'reusable-tabs'?
>
> Why?  If a target tab (a tab with the name specified by ALIST) exists
> on any frame specified by 'reusable-frames', reuse it.  Otherwise make
> a new frame with the target tab as its only entry.

I don't understand.  Should ALIST look like this?

(push '("test1" .
        ((display-buffer-reuse-window display-buffer-in-tab)
         (reusable-frames  . visible)
         (name . "Tab1")))
      display-buffer-alist)





reply via email to

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