* [BUG] Tab commands selecting by name
@ 2019-10-10 18:25 Ingo Lohmar
2019-10-12 22:05 ` Juri Linkov
0 siblings, 1 reply; 6+ messages in thread
From: Ingo Lohmar @ 2019-10-10 18:25 UTC (permalink / raw)
To: emacs-devel
I like the tab feature, it will make my separate `wconf' package
superfluous. :)
Currently, some interactive functions offer tabs by name
(tab-bar-switch-to-tab and tab-bar-close-tab-by-name, at least): They
directly use `(tab-bar-tabs)' to get the names to choose from. However,
the current tab's name in the return value is *not* up-to-date if it has
changed since the last time the tab has been visited (eg, showing a
different buffer in one window when using the -all-windows name
function).
I use this replacement for `tab-bar-tabs' instead:
(defun my/tab-bar-updated ()
(let ((tabs (tab-bar-tabs)))
(mapcar
(lambda (tab)
(if (eq (car tab) 'current-tab)
(tab-bar--current-tab) ;or (tab-bar--tab) for full info
tab))
tabs)))
Obviously, this could be merged with other functions to a more elegant
form, maybe even into tab-tar-tabs itself.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] Tab commands selecting by name
2019-10-10 18:25 [BUG] Tab commands selecting by name Ingo Lohmar
@ 2019-10-12 22:05 ` Juri Linkov
2019-10-13 5:46 ` Ingo Lohmar
0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2019-10-12 22:05 UTC (permalink / raw)
To: Ingo Lohmar; +Cc: emacs-devel
> Currently, some interactive functions offer tabs by name
> (tab-bar-switch-to-tab and tab-bar-close-tab-by-name, at least): They
> directly use `(tab-bar-tabs)' to get the names to choose from. However,
> the current tab's name in the return value is *not* up-to-date if it has
> changed since the last time the tab has been visited (eg, showing a
> different buffer in one window when using the -all-windows name
> function).
Does this problem really exists? The current tab name get updated
in tab-bar-make-keymap-1 very often, it's called by the display engine
on every window configuration change. So when you type
M-x tab-bar-close-tab-by-name, the current tab name is already
up-to-date.
Please provide a test case that reproduces this problem.
> I use this replacement for `tab-bar-tabs' instead:
>
> (defun my/tab-bar-updated ()
> (let ((tabs (tab-bar-tabs)))
> (mapcar
> (lambda (tab)
> (if (eq (car tab) 'current-tab)
> (tab-bar--current-tab) ;or (tab-bar--tab) for full info
> tab))
> tabs)))
>
> Obviously, this could be merged with other functions to a more elegant
> form, maybe even into tab-tar-tabs itself.
I guess you're overriding it using tab-bar-tabs-function?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] Tab commands selecting by name
2019-10-12 22:05 ` Juri Linkov
@ 2019-10-13 5:46 ` Ingo Lohmar
2019-10-13 20:12 ` Juri Linkov
0 siblings, 1 reply; 6+ messages in thread
From: Ingo Lohmar @ 2019-10-13 5:46 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
On Sun, Oct 13 2019 01:05 (+0300), Juri Linkov wrote:
>> Currently, some interactive functions offer tabs by name
>> (tab-bar-switch-to-tab and tab-bar-close-tab-by-name, at least): They
>> directly use `(tab-bar-tabs)' to get the names to choose from. However,
>> the current tab's name in the return value is *not* up-to-date if it has
>> changed since the last time the tab has been visited (eg, showing a
>> different buffer in one window when using the -all-windows name
>> function).
>
> Does this problem really exists? The current tab name get updated
> in tab-bar-make-keymap-1 very often, it's called by the display engine
> on every window configuration change. So when you type
> M-x tab-bar-close-tab-by-name, the current tab name is already
> up-to-date.
>
> Please provide a test case that reproduces this problem.
I forgot to mention a crucial ingredient, because it's so natural for
me: I have NOT turned on tab-bar-mode --- I do not want to see tabs,
just to use persistent window configs. In that case, I think, the
keymap you are talking about is not in play. So I am just using the
commands themselves, via actual keys.
But I don't really understand why the current-tab update is best placed
in that helper function, anyway, presumably to save some updating?
>> I use this replacement for `tab-bar-tabs' instead:
>>
>> (defun my/tab-bar-updated ()
>> (let ((tabs (tab-bar-tabs)))
>> (mapcar
>> (lambda (tab)
>> (if (eq (car tab) 'current-tab)
>> (tab-bar--current-tab) ;or (tab-bar--tab) for full info
>> tab))
>> tabs)))
>>
>> Obviously, this could be merged with other functions to a more elegant
>> form, maybe even into tab-tar-tabs itself.
>
> I guess you're overriding it using tab-bar-tabs-function?
Yes.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] Tab commands selecting by name
2019-10-13 5:46 ` Ingo Lohmar
@ 2019-10-13 20:12 ` Juri Linkov
2019-10-13 20:38 ` Ingo Lohmar
0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2019-10-13 20:12 UTC (permalink / raw)
To: Ingo Lohmar; +Cc: emacs-devel
>>> Currently, some interactive functions offer tabs by name
>>> (tab-bar-switch-to-tab and tab-bar-close-tab-by-name, at least): They
>>> directly use `(tab-bar-tabs)' to get the names to choose from. However,
>>> the current tab's name in the return value is *not* up-to-date if it has
>>> changed since the last time the tab has been visited (eg, showing a
>>> different buffer in one window when using the -all-windows name
>>> function).
>>
>> Does this problem really exists? The current tab name gets updated
>> in tab-bar-make-keymap-1 very often, it's called by the display engine
>> on every window configuration change. So when you type
>> M-x tab-bar-close-tab-by-name, the current tab name is already
>> up-to-date.
>>
>> Please provide a test case that reproduces this problem.
>
> I forgot to mention a crucial ingredient, because it's so natural for
> me: I have NOT turned on tab-bar-mode --- I do not want to see tabs,
> just to use persistent window configs. In that case, I think, the
> keymap you are talking about is not in play. So I am just using the
> commands themselves, via actual keys.
>
> But I don't really understand why the current-tab update is best placed
> in that helper function, anyway, presumably to save some updating?
I tried to avoid using window-configuration-change-hook
and indeed the current implementation uses no hooks at all.
But it seems now we still need to use window-configuration-change-hook
to update the current tab name on every window configuration change.
Or at least to use this hook when tab-bar-mode is disabled.
Or there is an alternative - to update the current tab name
explicitly in every command that uses tab names, and even in
their interactive spec that reads a tab name.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] Tab commands selecting by name
2019-10-13 20:12 ` Juri Linkov
@ 2019-10-13 20:38 ` Ingo Lohmar
2019-10-15 21:45 ` Juri Linkov
0 siblings, 1 reply; 6+ messages in thread
From: Ingo Lohmar @ 2019-10-13 20:38 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
On Sun, Oct 13 2019 23:12 (+0300), Juri Linkov wrote:
>> I forgot to mention a crucial ingredient, because it's so natural for
>> me: I have NOT turned on tab-bar-mode --- I do not want to see tabs,
>> just to use persistent window configs. In that case, I think, the
>> keymap you are talking about is not in play. So I am just using the
>> commands themselves, via actual keys.
>>
>> But I don't really understand why the current-tab update is best placed
>> in that helper function, anyway, presumably to save some updating?
>
> I tried to avoid using window-configuration-change-hook
> and indeed the current implementation uses no hooks at all.
>
> But it seems now we still need to use window-configuration-change-hook
> to update the current tab name on every window configuration change.
> Or at least to use this hook when tab-bar-mode is disabled.
>
> Or there is an alternative - to update the current tab name
> explicitly in every command that uses tab names, and even in
> their interactive spec that reads a tab name.
That's what I did (see my original message), and I think it is
sufficient --- there is no need to involve any hooks: Just declare that
`tab-bar-tabs' is the "single source of truth" for all but the
lowest-level functions, and update the current tab name (and, possibly,
window configuration?) at its start.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] Tab commands selecting by name
2019-10-13 20:38 ` Ingo Lohmar
@ 2019-10-15 21:45 ` Juri Linkov
0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2019-10-15 21:45 UTC (permalink / raw)
To: Ingo Lohmar; +Cc: emacs-devel
>>> I forgot to mention a crucial ingredient, because it's so natural for
>>> me: I have NOT turned on tab-bar-mode --- I do not want to see tabs,
>>> just to use persistent window configs. In that case, I think, the
>>> keymap you are talking about is not in play. So I am just using the
>>> commands themselves, via actual keys.
>>>
>>> But I don't really understand why the current-tab update is best placed
>>> in that helper function, anyway, presumably to save some updating?
>>
>> I tried to avoid using window-configuration-change-hook
>> and indeed the current implementation uses no hooks at all.
>>
>> But it seems now we still need to use window-configuration-change-hook
>> to update the current tab name on every window configuration change.
>> Or at least to use this hook when tab-bar-mode is disabled.
>>
>> Or there is an alternative - to update the current tab name
>> explicitly in every command that uses tab names, and even in
>> their interactive spec that reads a tab name.
>
> That's what I did (see my original message), and I think it is
> sufficient --- there is no need to involve any hooks: Just declare that
> `tab-bar-tabs' is the "single source of truth" for all but the
> lowest-level functions, and update the current tab name (and, possibly,
> window configuration?) at its start.
Thanks for the idea, now `tab-bar-tabs' is the single source of truth.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-10-15 21:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-10 18:25 [BUG] Tab commands selecting by name Ingo Lohmar
2019-10-12 22:05 ` Juri Linkov
2019-10-13 5:46 ` Ingo Lohmar
2019-10-13 20:12 ` Juri Linkov
2019-10-13 20:38 ` Ingo Lohmar
2019-10-15 21:45 ` Juri Linkov
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).