Function: tab-line-close-tab

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

Signature

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

Documentation

Close the selected tab.

This command is usually invoked by clicking on the close button on the right side of the tab. This command buries the buffer, so it goes out of sight of the tab line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/tab-line.el.gz
(defun tab-line-close-tab (&optional event)
  "Close the selected tab.
This command is usually invoked by clicking on the close button on the
right side of the tab.  This command buries the buffer, so it goes out of
sight of the tab line."
  (interactive (list last-nonmenu-event))
  (let* ((posnp (and (listp event) (event-start event)))
         (window (and posnp (posn-window posnp)))
         (tab (tab-line--get-tab-property 'tab (car (posn-string posnp))))
         (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab))))
         (close-function (unless (bufferp tab) (cdr (assq 'close tab)))))
    (with-selected-window (or window (selected-window))
      (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))))