Fix tab-line-tabs-buffer-groups (bug#59438)
* lisp/tab-line.el (tab-line-tabs-buffer-groups): Handle case when variable 'tab-line-tabs-buffer-groups-sort-function' is nil.
This commit is contained in:
parent
12132ec1ef
commit
451863adf9
1 changed files with 13 additions and 14 deletions
|
@ -387,7 +387,7 @@ Used only for `tab-line-tabs-mode-buffers' and `tab-line-tabs-buffer-groups'.")
|
|||
(defcustom tab-line-tabs-buffer-group-function
|
||||
#'tab-line-tabs-buffer-group-by-mode
|
||||
"Function to add a buffer to the appropriate group of tabs.
|
||||
Takes a buffer as arg and should return a group name as a string.
|
||||
Takes a buffer as argument and should return a group name as a string.
|
||||
If the return value is nil, the buffer has no group, so \"No group\"
|
||||
is displayed instead of a group name and the buffer is not grouped
|
||||
together with other buffers.
|
||||
|
@ -475,13 +475,14 @@ If non-nil, `tab-line-tabs-buffer-group-function' is used to
|
|||
generate the group name."
|
||||
(if (window-parameter nil 'tab-line-groups)
|
||||
(let* ((buffers (funcall tab-line-tabs-buffer-list-function))
|
||||
(groups
|
||||
(seq-sort tab-line-tabs-buffer-groups-sort-function
|
||||
(delq nil (mapcar #'car (seq-group-by
|
||||
(lambda (buffer)
|
||||
(tab-line-tabs-buffer-group-name
|
||||
buffer))
|
||||
buffers)))))
|
||||
(groups (delq nil
|
||||
(mapcar #'car
|
||||
(seq-group-by #'tab-line-tabs-buffer-group-name
|
||||
buffers))))
|
||||
(sorted-groups (if (functionp tab-line-tabs-buffer-groups-sort-function)
|
||||
(seq-sort tab-line-tabs-buffer-groups-sort-function
|
||||
groups)
|
||||
groups))
|
||||
(selected-group (window-parameter nil 'tab-line-group))
|
||||
(tabs
|
||||
(mapcar (lambda (group)
|
||||
|
@ -492,9 +493,8 @@ generate the group name."
|
|||
(set-window-parameter nil 'tab-line-groups nil)
|
||||
(set-window-parameter nil 'tab-line-group group)
|
||||
(set-window-parameter nil 'tab-line-hscroll nil)))))
|
||||
groups)))
|
||||
sorted-groups)))
|
||||
tabs)
|
||||
|
||||
(let* ((window-parameter (window-parameter nil 'tab-line-group))
|
||||
(group-name (tab-line-tabs-buffer-group-name (current-buffer)))
|
||||
(group (prog1 (or window-parameter group-name "No group")
|
||||
|
@ -507,10 +507,9 @@ generate the group name."
|
|||
(set-window-parameter nil 'tab-line-groups t)
|
||||
(set-window-parameter nil 'tab-line-group group)
|
||||
(set-window-parameter nil 'tab-line-hscroll nil)))))
|
||||
(buffers
|
||||
(seq-filter (lambda (b)
|
||||
(equal (tab-line-tabs-buffer-group-name b) group))
|
||||
(funcall tab-line-tabs-buffer-list-function)))
|
||||
(buffers (seq-filter (lambda (b)
|
||||
(equal (tab-line-tabs-buffer-group-name b) group))
|
||||
(funcall tab-line-tabs-buffer-list-function)))
|
||||
(sorted-buffers (if (functionp tab-line-tabs-buffer-group-sort-function)
|
||||
(seq-sort tab-line-tabs-buffer-group-sort-function
|
||||
buffers)
|
||||
|
|
Loading…
Add table
Reference in a new issue