From: Juri Linkov <juri@linkov.net>
To: Robert Cochran <robert-emacs@cochranmail.com>
Cc: "T.V Raman" <raman@google.com>, emacs-devel@gnu.org
Subject: Re: [PATCH] Enable persistent naming for tabs
Date: Thu, 31 Oct 2019 23:17:46 +0200 [thread overview]
Message-ID: <87sgn8pqbp.fsf@mail.linkov.net> (raw)
In-Reply-To: <87o8xxof8r.fsf@cochranmail.com> (Robert Cochran's message of "Wed, 30 Oct 2019 18:50:12 -0700")
>>> This looks like calling after the tab is created, so maybe a name like
>>>
>>> tab-bar-post-new-tab-functions (tab)
>>
>> I just realized we already have tab-bar-new-tab-choice.
>> Does it serve the same purpose?
>
> I don't think so. The function is supposed to return a buffer that is
> used as the starting buffer for the tab. That precludes doing any sort
> of manipulation of windows, buffers,
Manipulation of windows and buffers is possible in a function customized
for tab-bar-new-tab-choice. Such function could return (current-buffer)
or any other non-buffer value to avoid switch-to-buffer.
> and tab names. The function doesn't have lexical access to the tab
> variable in any way, either.
Modification of tab names is not possible with tab-bar-new-tab-choice indeed.
OTOH, naming the tab according to buffers in it is also possible by
customizing tab-bar-tab-name-function. However, I'm not sure about
prompting for a new name in it. So maybe a new hook is needed after all.
>>Maybe we need to add the prefix 'pre-' to indicate that the hook
>>is called before the command is executed, with a name e.g.:
>>
>> tab-bar-pre-close-tab-functions (tab)
>
> That name sounds fine by me, perhaps though 'hook' instead of
> 'functions'.
I like 'hook' more too because it is shorter than 'functions',
but I'm not sure about the current naming convention such as
(info "(elisp) Tips for Defining")
> And this is kind of going off into the weeds for a little
> bit, but maybe we can have an additional argument that indicates whether
> or not it's the last tab? I know that seems to overlap a little bit with
> last-tab-choice, but my goal is to try and work in as much mechanism as
> possible so that the user has plenty of freedom to have things behave
> exactly as they want. Seems to be in the spirit of Emacs. :)
Right, let's add all additional information.
> We could also use the return value to see if we should actually close
> the tab or not (ie if *any* of the tabs return a particular value, nil
> for the sake of argument, then the tab closing function will bail out
> early and not close the tab)? I could see this second thing being useful
> for programmatically 'protecting' a tab.
Protected tabs is a useful feature in some web browsers/addons.
Also there are locked tabs that are more like dedicated windows
e.g. https://www.tabmixplus.org/support/viewpage.php?t=3&p=frozen_tabs
>>This might require an additional utility function to get all buffers
>>from the tab (it could collect buffers by traversing readable window-state),
>>with a name:
>>
>> tab-bar-tab-buffers (tab)
>>
>>Such function is also needed for checking if a buffer exists in a tab
>>to prevent killing a buffer in the current tab with C-x k
>>when such buffer is still shown in some other tab.
>
> Having such a function could prove useful, yes. I'm not sure we should
> prevent killing a buffer if it's visible in another tab though. There's
> nothing stopping you from killing a buffer visible in another frame or
> another window, at least by default.
No by default, of course. Only as an option.
next prev parent reply other threads:[~2019-10-31 21:17 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 1:03 [PATCH] Enable persistent naming for tabs Robert Cochran
2019-10-10 21:43 ` Juri Linkov
[not found] ` <87ftjz6v4d.fsf@cochranmail.com>
2019-10-13 19:53 ` Juri Linkov
2019-10-15 21:45 ` Juri Linkov
2019-10-20 16:17 ` Juri Linkov
2019-10-20 23:54 ` T.V Raman
2019-10-21 21:34 ` Juri Linkov
2019-10-23 16:22 ` Robert Cochran
2019-10-23 20:41 ` Juri Linkov
2019-10-25 15:47 ` Robert Cochran
2019-10-25 16:01 ` Robert Cochran
2019-11-03 22:08 ` Robert Cochran
2019-11-03 22:37 ` Juri Linkov
2019-10-26 21:46 ` Juri Linkov
2019-10-30 18:35 ` Robert Cochran
2019-10-30 21:52 ` Juri Linkov
2019-10-30 23:05 ` Juri Linkov
2019-10-31 1:50 ` Robert Cochran
2019-10-31 21:17 ` Juri Linkov [this message]
2019-10-27 23:10 ` Juri Linkov
-- strict thread matches above, loose matches on Subject: below --
2019-10-08 22:26 Robert Cochran
2019-10-09 16:02 ` Eli Zaretskii
2019-10-09 22:58 ` Juri Linkov
2019-10-23 20:53 ` Kalman Reti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sgn8pqbp.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=emacs-devel@gnu.org \
--cc=raman@google.com \
--cc=robert-emacs@cochranmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).