Subject: bug#75945: tab-bar-new-tab-to tab post clone improvement

From: Ship Mints <[email-masked]>
Date: Thu, 30 Jan 2025 08:17:28 -0500

The existing hooks: post open, post close, post clone (patch submitted),
are insufficient in the tab clone case where users employ custom tab
parameters. Such tab parameters often need post-clone curation. In my case,
cumbersome tab-bar advice is needed to work around cloning. Others might
experience the same need.

I see a few ways we can help address this. Once we agree on an approach,
I'm happy to submit a patch.

1. Alter tab-bar-tab-post-open-functions to accept an optional second
argument, namely, the originating tab, iff tab-bar-new-tab-choice 'clone.

2. Create a new hook tab-bar-post-duplicate-tab-functions, the functions of
which accept two arguments: the originating tab, the cloned tab, and where
the hook runs iff tab-bar-new-tab-choice 'clone.

3. In harmony with clone-frame, tab-bar could propagate tab parameters to a
cloned tab (it already saves them naturally, for use in undo close tab),
modulo internal tab-bar parameters. A post-clone hook would still be needed
to allow a user to control their custom parameters. (A new post undo-close
tab hook patch is pending to support the undo case.)

4. In pseudo harmony with clone-frame, add
tab-bar-duplicate-tab-clone-parameters-functions hook, the user-provided
functions of which would accept the originating tab, and return the list of
parameters to clone.

My preference is 1, the simplest, but I can be persuaded that another on
this list, or a different one entirely, is acceptable.

-Stephane