emacs-devel
[Top][All Lists]
Advanced

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

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 via email to

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