87
87
88
88
89
89
(defcustom tab-bar-select-tab-modifiers '()
90
- " List of key modifiers for selecting a tab by its index digit.
91
- Possible modifiers are `control' , `meta' , `shift' , `hyper' , `super' and
92
- `alt' ."
93
- :type '(set :tag " Tab selection key modifiers"
90
+ " List of modifier keys for selecting a tab by its index digit.
91
+ Possible modifier keys are `control' , `meta' , `shift' , `hyper' , `super' and
92
+ `alt' . To help you to select a tab by its number, you can customize
93
+ `tab-bar-tab-hints' that will show tab numbers alongside the tab name."
94
+ :type '(set :tag " Tab selection modifier keys"
94
95
(const control)
95
96
(const meta)
96
97
(const shift)
@@ -310,7 +311,8 @@ If nil, don't show it at all."
310
311
311
312
(defcustom tab-bar-tab-hints nil
312
313
" Show absolute numbers on tabs in the tab bar before the tab name.
313
- This helps to select the tab by its number using `tab-bar-select-tab' ."
314
+ This helps to select the tab by its number using `tab-bar-select-tab'
315
+ and `tab-bar-select-tab-modifiers' ."
314
316
:type 'boolean
315
317
:initialize 'custom-initialize-default
316
318
:set (lambda (sym val )
@@ -563,9 +565,10 @@ Return its existing value or a new value."
563
565
564
566
(defun tab-bar-select-tab (&optional arg )
565
567
" Switch to the tab by its absolute position ARG in the tab bar.
566
- When this command is bound to a numeric key (with a prefix or modifier),
567
- calling it without an argument will translate its bound numeric key
568
- to the numeric argument. ARG counts from 1."
568
+ When this command is bound to a numeric key (with a prefix or modifier key
569
+ using `tab-bar-select-tab-modifiers' ), calling it without an argument
570
+ will translate its bound numeric key to the numeric argument.
571
+ ARG counts from 1."
569
572
(interactive " P" )
570
573
(unless (integerp arg)
571
574
(let ((key (event-basic-type last-command-event)))
@@ -664,7 +667,10 @@ to the numeric argument. ARG counts from 1."
664
667
(message " No more recent tabs " ))))
665
668
666
669
(defun tab-bar-switch-to-tab (name )
667
- " Switch to the tab by NAME."
670
+ " Switch to the tab by NAME.
671
+ Default values are tab names sorted by recency, so you can use \
672
+ \\ <minibuffer-local-map>\\ [next-history-element]
673
+ to get the name of the last visited tab, the second last, and so on."
668
674
(interactive
669
675
(let* ((recent-tabs (mapcar (lambda (tab )
670
676
(alist-get 'name tab))
@@ -789,7 +795,7 @@ After the tab is created, the hooks in
789
795
(pcase tab-bar-new-tab-to
790
796
('leftmost 0 )
791
797
('rightmost (length tabs))
792
- ('left (1- ( or from-index 1 ) ))
798
+ ('left (or from-index 1 ))
793
799
('right (1+ (or from-index 0 )))
794
800
((pred functionp)
795
801
(funcall tab-bar-new-tab-to))))))
@@ -920,7 +926,7 @@ for the last tab on a frame is determined by
920
926
; ; Select another tab before deleting the current tab
921
927
(let ((to-index (or (if to-index (1- to-index))
922
928
(pcase tab-bar-close-tab-select
923
- ('left (1- current-index))
929
+ ('left (1- ( if ( < current-index 1 ) 2 current-index) ))
924
930
('right (if (> (length tabs) (1+ current-index))
925
931
(1+ current-index)
926
932
(1- current-index)))
@@ -1004,7 +1010,7 @@ for the last tab on a frame is determined by
1004
1010
(unless (eq frame (selected-frame ))
1005
1011
(select-frame-set-input-focus frame))
1006
1012
1007
- (let ((tabs (tab-bar-tabs)))
1013
+ (let ((tabs (funcall tab-bar-tabs-function )))
1008
1014
(setq index (max 0 (min index (length tabs))))
1009
1015
(cl-pushnew tab (nthcdr index tabs))
1010
1016
(when (eq index 0 )
@@ -1102,6 +1108,8 @@ function `tab-bar-tab-name-function'."
1102
1108
(setq tab-bar-history-omit nil )))
1103
1109
1104
1110
(defun tab-bar-history-back ()
1111
+ " Restore a previous window configuration used in the current tab.
1112
+ This navigates back in the history of window configurations."
1105
1113
(interactive )
1106
1114
(setq tab-bar-history-omit t )
1107
1115
(let* ((history (pop (gethash (selected-frame ) tab-bar-history-back)))
@@ -1119,6 +1127,8 @@ function `tab-bar-tab-name-function'."
1119
1127
(message " No more tab back history " ))))
1120
1128
1121
1129
(defun tab-bar-history-forward ()
1130
+ " Cancel restoration of the previous window configuration.
1131
+ This navigates forward in the history of window configurations."
1122
1132
(interactive )
1123
1133
(setq tab-bar-history-omit t )
1124
1134
(let* ((history (pop (gethash (selected-frame ) tab-bar-history-forward)))
@@ -1136,7 +1146,9 @@ function `tab-bar-tab-name-function'."
1136
1146
(message " No more tab forward history " ))))
1137
1147
1138
1148
(define-minor-mode tab-bar-history-mode
1139
- " Toggle tab history mode for the tab bar."
1149
+ " Toggle tab history mode for the tab bar.
1150
+ Tab history mode remembers window configurations used in every tab,
1151
+ and can restore them."
1140
1152
:global t :group 'tab-bar
1141
1153
(if tab-bar-history-mode
1142
1154
(progn
0 commit comments