all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Adam Porter <adam@alphapapa.net>
Cc: emacs-devel@gnu.org
Subject: Re: tab-bar-switch-to-tab removes custom tab data?
Date: Mon, 20 Sep 2021 18:28:47 +0300	[thread overview]
Message-ID: <87lf3rpghc.fsf@mail.linkov.net> (raw)
In-Reply-To: <871r5jpxed.fsf@mail.linkov.net> (Juri Linkov's message of "Mon,  20 Sep 2021 09:45:22 +0300")

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

>> 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 is a patch that implements this, but it's still 100% untested,
so use it at your own risk :)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: custom-tab-data.patch --]
[-- Type: text/x-diff, Size: 1804 bytes --]

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index c19b754543..7f9b56c7d2 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -931,7 +931,15 @@ tab-bar--tab
       (wc-bl . ,bl)
       (wc-bbl . ,bbl)
       (wc-history-back . ,(gethash (or frame (selected-frame)) tab-bar-history-back))
-      (wc-history-forward . ,(gethash (or frame (selected-frame)) tab-bar-history-forward)))))
+      (wc-history-forward . ,(gethash (or frame (selected-frame)) tab-bar-history-forward))
+      ;; Copy other possible parameters
+      ,@(mapcan (lambda (param)
+                  (unless (memq (car param)
+                                '(name explicit-name group time
+                                  ws wc wc-point wc-bl wc-bbl
+                                  wc-history-back wc-history-forward))
+                    (list param)))
+                (cdr tab)))))
 
 (defun tab-bar--current-tab (&optional tab frame)
   (tab-bar--current-tab-make (or tab (tab-bar--current-tab-find nil frame))))
@@ -951,7 +959,15 @@ tab-bar--current-tab-make
                    (alist-get 'name tab)
                  (funcall tab-bar-tab-name-function)))
       (explicit-name . ,tab-explicit-name)
-      ,@(if tab-group `((group . ,tab-group))))))
+      ,@(if tab-group `((group . ,tab-group)))
+      ;; Copy other possible parameters
+      ,@(mapcan (lambda (param)
+                  (unless (memq (car param)
+                                '(name explicit-name group time
+                                  ws wc wc-point wc-bl wc-bbl
+                                  wc-history-back wc-history-forward))
+                    (list param)))
+                (cdr tab)))))
 
 (defun tab-bar--current-tab-find (&optional tabs frame)
   (assq 'current-tab (or tabs (funcall tab-bar-tabs-function frame))))

  reply	other threads:[~2021-09-20 15:28 UTC|newest]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf3rpghc.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.