Function: tab-line-close-other-tabs

tab-line-close-other-tabs is an interactive and byte-compiled function defined in tab-line.el.gz.

Signature

(tab-line-close-other-tabs &optional EVENT)

Documentation

Close all tabs on the selected window, except the tab on EVENT.

It preforms the same actions on the closed tabs as in tab-line-close-tab.

Probably introduced at or before Emacs version 31.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/tab-line.el.gz
(defun tab-line-close-other-tabs (&optional event)
  "Close all tabs on the selected window, except the tab on EVENT.
It preforms the same actions on the closed tabs as in `tab-line-close-tab'."
  (interactive (list last-nonmenu-event))
  (when (tab-line-track-tap event)
    (let* ((posnp (tab-line-event-start event))
           (keep-tab (if (consp event)
                         (tab-line--get-tab-property 'tab (car (posn-string posnp)))
                       (tab-line--current-tab))))
      (with-selected-window (posn-window posnp)
        (dolist (tab (delete keep-tab (funcall tab-line-tabs-function)))
          (let ((buffer (if (bufferp tab) tab (cdr (assq 'buffer tab))))
                (close-function (unless (bufferp tab) (cdr (assq 'close tab)))))
            (cond
             ((functionp close-function)
              (funcall close-function))
             ((eq tab-line-close-tab-function 'kill-buffer)
              (kill-buffer buffer))
             ((eq tab-line-close-tab-function 'bury-buffer)
              (if (eq buffer (current-buffer))
                  (bury-buffer)
                (set-window-prev-buffers nil (assq-delete-all buffer (window-prev-buffers)))
                (set-window-next-buffers nil (delq buffer (window-next-buffers)))))
             ((functionp tab-line-close-tab-function)
              (funcall tab-line-close-tab-function tab)))))
        (force-mode-line-update)))))