emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Enable persistent naming for tabs


From: Robert Cochran
Subject: Re: [PATCH] Enable persistent naming for tabs
Date: Wed, 30 Oct 2019 11:35:37 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Juri Linkov <address@hidden> writes:

>> It occurred to me in the process of writing this up that it might be
>> useful to provide hook variables for creating and closing tabs -
>> 'tab-bar-tab-open-hook' and 'tab-bar-tab-close-hook' perhaps? Standard
>> fare on those - a list of functions that take the tab as an argument,
>> probably called as the last task of tab creation and the first task of
>> tab closing? Thoughts?
>
> Not sure if this could be a hook on tab-bar basic events,
> or a customizable function.  Also not clear whether to call it
> before or after the main body.
>
> We need to collect more examples of use cases to decide
> on the implementation.

I believe it better to be a hook personally, though admittedly that kind
of depends on how exactly you want to use the functionality. A hook
allows for several interested parties to be able to act on a tab
create/close instead of just one. This allows better for dynamically
adding or removing situationally dependent behavior. For example, maybe
I want to kill some/all of the buffers in the tab when I close it, but
only under certain circumstances, like if it's a tab containing non-file
'work' buffers like those of Magit or mpd. Another is if I open a new
tab, and I want to be prompted to name the tab automatically depending
on the buffers that exist at the time of creation - I have a tendency to
segregate all of my Magit buffers for a repository into a single tab,
and I usually rename the tab so that no matter what Magit sub-buffer I'm
on, the tab still has a consistent name. I can see myself doing similar
for other 'task-oriented' sets of windows and buffers such as gdb, mpd,
etc.

Either way, I suggest that we call any type of user-defined function on
tab creation at the end of the function body, and any type of
user-defined function on tab deletion at the beginning of the function
body. IMO there's nothing reasonable to do on tab creation until after
most of the work has been done already anyways, and that it's too late
to do anything on tab close except at the very beginning, when it's
still an open tab.

Thanks,
-- 
~Robert Cochran



reply via email to

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