Function: tab-bar-switch-to-tab

tab-bar-switch-to-tab is an interactive and byte-compiled function defined in tab-bar.el.gz.

Signature

(tab-bar-switch-to-tab NAME)

Documentation

Switch to the tab by NAME.

Default values are tab names sorted by recency, so you can use M-n (next-history-element) to get the name of the most recently visited tab, the second most recent, and so on.

Key Bindings

Aliases

tab-switch tab-bar-select-tab-by-name

Source Code

;; Defined in /usr/src/emacs/lisp/tab-bar.el.gz
(defun tab-bar-switch-to-tab (name)
  "Switch to the tab by NAME.
Default values are tab names sorted by recency, so you can use \
\\<minibuffer-local-map>\\[next-history-element]
to get the name of the most recently visited tab, the second
most recent, and so on."
  (interactive
   (let* ((recent-tabs (mapcar (lambda (tab)
                                 (alist-get 'name tab))
                               (tab-bar--tabs-recent))))
     (list (completing-read (format-prompt "Switch to tab by name"
                                           (car recent-tabs))
                            recent-tabs nil nil nil nil recent-tabs))))
  (tab-bar-select-tab (1+ (or (tab-bar--tab-index-by-name name) 0))))