* bug#52050: [PATCH] Make tab-line-switch-cycling work with buffer groups
@ 2021-11-23 4:16 Matt Kramer
2021-11-23 8:06 ` Juri Linkov
0 siblings, 1 reply; 4+ messages in thread
From: Matt Kramer @ 2021-11-23 4:16 UTC (permalink / raw)
To: 52050
[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]
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 <mkramer@lbl.gov>
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
[-- Attachment #2: Type: text/html, Size: 2291 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#52050: [PATCH] Make tab-line-switch-cycling work with buffer groups
2021-11-23 4:16 bug#52050: [PATCH] Make tab-line-switch-cycling work with buffer groups Matt Kramer
@ 2021-11-23 8:06 ` Juri Linkov
2021-11-23 9:41 ` Matt Kramer
0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2021-11-23 8:06 UTC (permalink / raw)
To: Matt Kramer; +Cc: 52050
> 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.
Thanks for the patch. Please send your complete tab-line setup,
so we could test and verify that your patch correctly fixes the problem.
I see at least these settings:
(setq tab-line-switch-cycling t)
(setq tab-line-tabs-function 'tab-line-tabs-buffer-groups)
But it seems you also modified either tab-line-tabs-buffer-list-function,
or tab-line-tabs-buffer-group-sort-function, or both of them. Is this true?
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#52050: [PATCH] Make tab-line-switch-cycling work with buffer groups
2021-11-23 8:06 ` Juri Linkov
@ 2021-11-23 9:41 ` Matt Kramer
2021-11-24 19:43 ` Juri Linkov
0 siblings, 1 reply; 4+ messages in thread
From: Matt Kramer @ 2021-11-23 9:41 UTC (permalink / raw)
To: Juri Linkov; +Cc: 52050
[-- Attachment #1: Type: text/plain, Size: 1043 bytes --]
>
> But it seems you also modified either tab-line-tabs-buffer-list-function,
> or tab-line-tabs-buffer-group-sort-function, or both of them. Is this
> true?
>
Yes to tab-line-tabs-buffer-group-sort-function, no to
tab-line-tabs-buffer-list-function, yes also to
tab-line-tabs-buffer-group-function. Setup is below:
(defvar ++buffer-group-table
(make-hash-table :test 'equal))
;; I manually populate ++buffer-group-table
(defun ++tab-line-buffer-group (buffer)
(gethash (buffer-name buffer) ++buffer-group-table
(with-current-buffer buffer
(concat (symbol-name major-mode)
":"
(and buffer-file-name
(file-name-directory buffer-file-name))))))
(defun ++buffer-name< (a b)
(string< (buffer-name a) (buffer-name b)))
(setq tab-line-tabs-function #'tab-line-tabs-buffer-groups
tab-line-tabs-buffer-group-function #'++tab-line-buffer-group
tab-line-tabs-buffer-group-sort-function #'++buffer-name<
tab-line-switch-cycling t)
[-- Attachment #2: Type: text/html, Size: 1510 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#52050: [PATCH] Make tab-line-switch-cycling work with buffer groups
2021-11-23 9:41 ` Matt Kramer
@ 2021-11-24 19:43 ` Juri Linkov
0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2021-11-24 19:43 UTC (permalink / raw)
To: Matt Kramer; +Cc: 52050
close 52050 29.0.50
thanks
> But it seems you also modified either
> tab-line-tabs-buffer-list-function,
> or tab-line-tabs-buffer-group-sort-function, or both of them. Is this
> true?
>
> Yes to tab-line-tabs-buffer-group-sort-function, no to
> tab-line-tabs-buffer-list-function, yes also to
> tab-line-tabs-buffer-group-function. Setup is below:
Thanks, now confirmed that it works as it should,
so your patch is pushed to master.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-24 19:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-23 4:16 bug#52050: [PATCH] Make tab-line-switch-cycling work with buffer groups Matt Kramer
2021-11-23 8:06 ` Juri Linkov
2021-11-23 9:41 ` Matt Kramer
2021-11-24 19:43 ` Juri Linkov
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).