[Top][All Lists]

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

Re: [PATCH] Enable persistent naming for tabs

From: Kalman Reti
Subject: Re: [PATCH] Enable persistent naming for tabs
Date: Wed, 23 Oct 2019 16:53:23 -0400


On Wed, Oct 9, 2019 at 11:48 AM Robert Cochran <address@hidden> wrote:
Hi emacs-devel,

I saw news recently of the new tabs that are on master. They're really
nifty - kudos to Juri Linkov for doing a lot of work on them. :)

I was admittedly a little disappointed, however, to see that the user, or
other Lisp programs, couldn't change the name of a tab persistently - it
*could* be changed, but a lot of the functions that handle tabs
immediately call the automatic naming function, before the UI could even
update to display it. Some applications might want to have a consistent
name divorced from the current buffer, and sometimes it would be nice to
override the automatic name on a per-tab basis as a user.

The solution I went with was another value in the tabs frame-parameter
alist. A new cons with the name `no-auto-name` in the car is used. If
the cdr is nil, then the behavior we have now remains - the tab handling
functions will call the value of `tab-bar-tab-name-function` and update
the name immediately. With a non-nil value, any time
`tab-bar-tab-name-function` would be called, the existing name is
instead substituted.

I've added 2 new functions, `tab-bar-rename-tab` and
`tab-bar-rename-tab-by-name`. Both functions take a new name, and a tag
identifier, either a frame tab index or an existing name,
respectively. The new name is then set on the tab, and the
`no-auto-name` parameter is set non-nil, unless the new name is the
empty string, which is taken to mean 'turn automatic naming back on'.

A couple of things I'm still wondering about: should this be documented
in the manual? I was going to do so, but couldn't really find a good
spot to mention it. If we do add something to the manual, we should
mention `tab-bar-tab-name-function` as well. Do we want to add this to
the default `C-x 6` binds, possibly as `C-x 6 r`? I already set
`tab-rename` as an alias to `tab-bar-rename-tab`, but I'm curious what
other people are thinking on that. Is there a better name for
`no-auto-name`? I couldn't think of a better one... I was aiming to have
a name who's interpretation as 'nil' is 'don't do anything differently',
so as to make the code slightly easier to read, as well as ensuring
saved tabs don't get automatic naming turned on by mistake.

~Robert Cochran

reply via email to

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