Function: tab-bar-change-tab-group
tab-bar-change-tab-group is an interactive and byte-compiled function
defined in tab-bar.el.gz.
Signature
(tab-bar-change-tab-group GROUP-NAME &optional TAB-NUMBER)
Documentation
Add the tab specified by its absolute position TAB-NUMBER to GROUP-NAME.
If no TAB-NUMBER is specified, then set the GROUP-NAME for the current tab.
Interactively, TAB-NUMBER is the prefix numeric argument, and the command
prompts for GROUP-NAME.
TAB-NUMBER counts from 1.
If GROUP-NAME is the empty string, then remove the tab from any group.
While using this command, you might also want to replace
tab-bar-format-tabs with tab-bar-format-tabs-groups in
tab-bar-format to group tabs on the tab bar.
Runs the hook tab-bar-tab-post-change-group-functions at the end.
Key Bindings
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/tab-bar.el.gz
(defun tab-bar-change-tab-group (group-name &optional tab-number)
"Add the tab specified by its absolute position TAB-NUMBER to GROUP-NAME.
If no TAB-NUMBER is specified, then set the GROUP-NAME for the current tab.
Interactively, TAB-NUMBER is the prefix numeric argument, and the command
prompts for GROUP-NAME.
TAB-NUMBER counts from 1.
If GROUP-NAME is the empty string, then remove the tab from any group.
While using this command, you might also want to replace
`tab-bar-format-tabs' with `tab-bar-format-tabs-groups' in
`tab-bar-format' to group tabs on the tab bar.
Runs the hook `tab-bar-tab-post-change-group-functions' at the end."
(interactive
(let* ((tabs (funcall tab-bar-tabs-function))
(tab-number (or current-prefix-arg
(1+ (tab-bar--current-tab-index tabs))))
(group-name (funcall tab-bar-tab-group-function
(nth (1- tab-number) tabs))))
(list (completing-read
"Group name for tab (leave blank to remove group): "
(delete-dups
(delq nil (cons group-name
(mapcar (lambda (tab)
(funcall tab-bar-tab-group-function tab))
(funcall tab-bar-tabs-function))))))
current-prefix-arg)))
(let* ((tabs (funcall tab-bar-tabs-function))
(tab-index (if tab-number
(1- (max 0 (min tab-number (length tabs))))
(tab-bar--current-tab-index tabs)))
(tab (nth tab-index tabs))
(group (assq 'group tab))
(group-new-name (and (> (length group-name) 0) group-name)))
(if group
(setcdr group group-new-name)
(nconc tab `((group . ,group-new-name))))
(run-hook-with-args 'tab-bar-tab-post-change-group-functions tab)
(force-mode-line-update)
(unless tab-bar-mode
(message "Set tab group to '%s'" group-new-name))))