Function: kill-this-buffer
kill-this-buffer is an interactive and byte-compiled function defined
in menu-bar.el.gz.
Signature
(kill-this-buffer &optional EVENT)
Documentation
Kill the current buffer.
When called in the minibuffer, get out of the minibuffer
using abort-recursive-edit.
This command must be bound to a mouse event, and can be reliably
invoked only from the menu bar, otherwise it could decide to silently
do nothing or signal an error. Use kill-current-buffer if you
need to invoke a similar command from keyboard.
Probably introduced at or before Emacs version 24.3.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/menu-bar.el.gz
(defun kill-this-buffer (&optional event) ; for the menu bar
"Kill the current buffer.
When called in the minibuffer, get out of the minibuffer
using `abort-recursive-edit'.
This command must be bound to a mouse event, and can be reliably
invoked only from the menu bar, otherwise it could decide to silently
do nothing or signal an error. Use `kill-current-buffer' if you
need to invoke a similar command from keyboard."
(interactive "e")
;; This colossus of a conditional is necessary to account for the wide
;; variety of this command's callers.
(if (let* ((window (or (and event (event-start event)
(posn-window (event-start event)))
last-event-frame
(selected-frame)))
(frame (if (framep window) window
(window-frame window))))
(not (window-minibuffer-p (frame-selected-window frame))))
(progn (kill-buffer (current-buffer))
;; Also close the current window if `menu-bar-close-window' is
;; set.
(when menu-bar-close-window
(ignore-errors (delete-window))))
(abort-recursive-edit)))