summaryrefslogtreecommitdiff
path: root/lisp/tab-bar.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2022-11-30 21:36:33 +0200
committerJuri Linkov <juri@linkov.net>2022-11-30 21:37:28 +0200
commit7397f2099b6c2053c5996e8679b6e2856224569b (patch)
tree2516a8f09194d917e57bf82c8b08fd80aa11b530 /lisp/tab-bar.el
parent832b013ef041b13a55f9ccf6e1eca617f605753c (diff)
downloademacs-7397f2099b6c2053c5996e8679b6e2856224569b.tar.gz
emacs-7397f2099b6c2053c5996e8679b6e2856224569b.tar.bz2
emacs-7397f2099b6c2053c5996e8679b6e2856224569b.zip
* lisp/tab-bar.el: Keep tabs of the same group together (bug#59721)
(tab-bar-tab-post-change-group-functions): Change the default value to '(tab-bar-move-tab-to-group)'. Improve docstring. (tab-bar-change-tab-group): Improve docstring.
Diffstat (limited to 'lisp/tab-bar.el')
-rw-r--r--lisp/tab-bar.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index f77f7492c30..2f8e8b29348 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1920,13 +1920,16 @@ function `tab-bar-tab-name-function'."
(when pos
(tab-bar-move-tab-to pos (1+ tab-index)))))
-(defcustom tab-bar-tab-post-change-group-functions nil
+(defcustom tab-bar-tab-post-change-group-functions '(tab-bar-move-tab-to-group)
"List of functions to call after changing a tab group.
-The current tab is supplied as an argument."
+This hook is run at the end of the function `tab-bar-change-tab-group'.
+The current tab is supplied as an argument. You can use any function,
+but by default it enables the function `tab-bar-move-tab-to-group'
+that moves the tab closer to its group."
:type 'hook
:options '(tab-bar-move-tab-to-group)
:group 'tab-bar
- :version "28.1")
+ :version "29.1")
(defun tab-bar-change-tab-group (group-name &optional tab-number)
"Add the tab specified by its absolute position TAB-NUMBER to GROUP-NAME.
@@ -1937,7 +1940,8 @@ 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."
+`tab-bar-format' to group tabs on the tab bar.
+At the end it runs the hook `tab-bar-tab-post-change-group-functions'."
(interactive
(let* ((tabs (funcall tab-bar-tabs-function))
(tab-number (or current-prefix-arg