[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tab-bar-switch-to-tab removes custom tab data?
From: |
Juri Linkov |
Subject: |
Re: tab-bar-switch-to-tab removes custom tab data? |
Date: |
Mon, 20 Sep 2021 09:45:22 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
> I'm not sure if this is intended, or if what I'm doing is allowed, but I
> noticed that after I add an association to the current tab and then use
> tab-switch twice, to change tab and then change back, the association I
> added is gone.
So you want to add more metadata to a tab?
Once in the past I proposed such a feature,
but no one needed it :) Now this could be added.
> Here's the function I'm using to add the association:
>
> (defun burly-tab--windows-set-after-advice (&rest _ignore)
> "Set current tab's `burly-bookmark-name' to BOOKMARK-NAME.
> To be used as advice to `burly--windows-set'."
> (tab-rename burly-opened-bookmark-name)
> (let ((current-tab (tab-bar--current-tab-find)))
> (setf (alist-get 'burly-bookmark-name (cdr current-tab))
> burly-opened-bookmark-name)))
>
> After that function is run, this:
>
> (tab-bar--current-tab-find)
>
> Evaluates to:
>
> (current-tab
> (burly-bookmark-name .
> #("Burly: Burly.el" 0 15
> (face nil)))
> (name .
> #("Burly: Burly.el" 0 15
> (face nil)))
> (explicit-name . t))
>
> Then after switching tabs and back, it evaluates to:
>
> (current-tab
> (name .
> #("Burly: Burly.el" 0 15
> (face nil)))
> (explicit-name . t))
>
> I assumed that, since the tab is an alist, I could add my own data to
> it, but maybe this is not intended. If not, could it become so? :) I
> could work around it by using the tab's name, but that would be less
> flexible and robust. I'd also like to store other data to tabs in the
> future, and that wouldn't work as well with relying on the tab name.
I completely agree, this should be supported asap.