(explicit-name . ,tab-explicit-name)
,@(if tab-group `((group . ,tab-group))))))
+(defun tab-bar--current-tab-find (&optional tabs frame)
+ (seq-find (lambda (tab) (eq (car tab) 'current-tab))
+ (or tabs (funcall tab-bar-tabs-function frame))))
+
(defun tab-bar--current-tab-index (&optional tabs frame)
(seq-position (or tabs (funcall tab-bar-tabs-function frame))
'current-tab (lambda (a b) (eq (car a) b))))
"Close all tabs on the selected frame, except the selected one."
(interactive)
(let* ((tabs (funcall tab-bar-tabs-function))
- (current-index (tab-bar--current-tab-index tabs))
- (current-tab (and current-index (nth current-index tabs)))
+ (current-tab (tab-bar--current-tab-find tabs))
(index 0))
(when current-tab
(dolist (tab tabs)
"Close all tabs that belong to GROUP-NAME on the selected frame."
(interactive
(let* ((tabs (funcall tab-bar-tabs-function))
- (tab-index (1+ (tab-bar--current-tab-index tabs)))
- (group-name (alist-get 'group (nth (1- tab-index) tabs))))
+ (group-name (alist-get 'group (tab-bar--current-tab-find tabs))))
(list (completing-read
"Close all tabs with group name: "
(delete-dups (delq nil (cons group-name
(tab-bar-close-other-tabs)
(let* ((tabs (funcall tab-bar-tabs-function))
- (current-index (tab-bar--current-tab-index tabs))
- (current-tab (and current-index (nth current-index tabs))))
+ (current-tab (tab-bar--current-tab-find tabs)))
(when (and current-tab (equal (alist-get 'group current-tab)
close-group))
(tab-bar-close-tab)))))
(defvar tab-bar-history-old-minibuffer-depth 0
"Minibuffer depth before the current command.")
-(defun tab-bar-history--pre-change ()
+(defun tab-bar--history-pre-change ()
(setq tab-bar-history-old-minibuffer-depth (minibuffer-depth))
;; Store wc before possibly entering the minibuffer
(when (zerop tab-bar-history-old-minibuffer-depth)
:ascent center))
tab-bar-forward-button))
- (add-hook 'pre-command-hook 'tab-bar-history--pre-change)
+ (add-hook 'pre-command-hook 'tab-bar--history-pre-change)
(add-hook 'window-configuration-change-hook 'tab-bar--history-change))
- (remove-hook 'pre-command-hook 'tab-bar-history--pre-change)
+ (remove-hook 'pre-command-hook 'tab-bar--history-pre-change)
(remove-hook 'window-configuration-change-hook 'tab-bar--history-change)))
\f