Function: tab-line-switch-to-prev-tab
tab-line-switch-to-prev-tab is an interactive and byte-compiled
function defined in tab-line.el.gz.
Signature
(tab-line-switch-to-prev-tab &optional EVENT ARG)
Documentation
Switch to the ARGth previous tab's buffer.
When tab-line-tabs-function is tab-line-tabs-window-buffers,
its effect is the same as using the previous-buffer command
(C-x <left> (previous-buffer)).
For other values of tab-line-tabs-function this command
switches to the previous buffer in the sequence defined by
tab-line-tabs-function. To wrap buffer cycling in this case
is possible when tab-line-switch-cycling is non-nil.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/tab-line.el.gz
(defun tab-line-switch-to-prev-tab (&optional event arg)
"Switch to the ARGth previous tab's buffer.
When `tab-line-tabs-function' is `tab-line-tabs-window-buffers',
its effect is the same as using the `previous-buffer' command
\(\\[previous-buffer]).
For other values of `tab-line-tabs-function' this command
switches to the previous buffer in the sequence defined by
`tab-line-tabs-function'. To wrap buffer cycling in this case
is possible when `tab-line-switch-cycling' is non-nil."
(interactive (list last-nonmenu-event
(prefix-numeric-value current-prefix-arg)))
(let ((window (and (listp event) (posn-window (event-start event)))))
(with-selected-window (or window (selected-window))
(if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers)
(previous-buffer arg t)
(let* ((buffers (seq-keep
(lambda (tab) (or (and (bufferp tab) tab)
(alist-get 'buffer tab)))
(funcall tab-line-tabs-function)))
(old-pos (seq-position buffers (current-buffer)))
(new-pos (when old-pos (- old-pos (or arg 1))))
(new-pos (when new-pos
(if tab-line-switch-cycling
(mod new-pos (length buffers))
(max new-pos 0))))
(buffer (when new-pos (nth new-pos buffers))))
(when (bufferp buffer)
(let ((switch-to-buffer-obey-display-actions nil))
(switch-to-buffer buffer))))))))