unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: emacs-devel@gnu.org
Subject: tab-bar-switch-to-tab removes custom tab data?
Date: Sun, 19 Sep 2021 17:40:51 -0500	[thread overview]
Message-ID: <8735q089zg.fsf@alphapapa.net> (raw)

Hi Juri, et al,

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.

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.

--
Thanks,
Adam




             reply	other threads:[~2021-09-19 22:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19 22:40 Adam Porter [this message]
2021-09-20  6:45 ` tab-bar-switch-to-tab removes custom tab data? Juri Linkov
2021-09-20 15:28   ` Juri Linkov
2021-09-20 23:20     ` Adam Porter
2021-09-21 17:46       ` Juri Linkov

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=8735q089zg.fsf@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=emacs-devel@gnu.org \
    /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).