Subject: bug#52050: [PATCH] Make tab-line-switch-cycling work with buffer groups

From: Matt Kramer <[email-masked]>
Date: Mon, 22 Nov 2021 20:16:09 -0800

Currently, `tab-line-switch-cycling' has no effect in the presence of any
tab that isn't associated with a buffer, such as the `group-tab' that
exists when `tab-line-tabs-function' is `tab-line-tabs-buffer-groups'. This
patch modifies `tab-line-switch-to-{next,prev}-tab' to remove any such tab
from consideration.

>From 205cebc3a05884d948a5ea45688732cbe1b948ea Mon Sep 17 00:00:00 2001
From: Matt Kramer <[email-masked]>
Date: Mon, 22 Nov 2021 20:03:01 -0800
Subject: [PATCH] Fix tab-line cycling when using buffer groups

---
 lisp/tab-line.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 110c6e9696..af0647acf7 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -792,7 +792,9 @@ tab-line-switch-to-prev-tab
     (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers)
         (switch-to-prev-buffer window)
       (with-selected-window (or window (selected-window))
-        (let* ((tabs (funcall tab-line-tabs-function))
+        (let* ((tabs (seq-filter
+                      (lambda (tab) (or (bufferp tab) (assq 'buffer tab)))
+                      (funcall tab-line-tabs-function)))
                (pos (seq-position
                      tabs (current-buffer)
                      (lambda (tab buffer)
@@ -816,7 +818,9 @@ tab-line-switch-to-next-tab
     (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers)
         (switch-to-next-buffer window)
       (with-selected-window (or window (selected-window))
-        (let* ((tabs (funcall tab-line-tabs-function))
+        (let* ((tabs (seq-filter
+                      (lambda (tab) (or (bufferp tab) (assq 'buffer tab)))
+                      (funcall tab-line-tabs-function)))
                (pos (seq-position
                      tabs (current-buffer)
                      (lambda (tab buffer)
-- 
2.26.2