Function: kill-this-buffer-enabled-p

kill-this-buffer-enabled-p is a byte-compiled function defined in menu-bar.el.gz.

Signature

(kill-this-buffer-enabled-p)

Documentation

Return non-nil if the kill-this-buffer menu item should be enabled.

It should be enabled there is at least one non-hidden buffer, or if menu-bar-close-window is non-nil and there is more than one window on this frame.

Source Code

;; Defined in /usr/src/emacs/lisp/menu-bar.el.gz
(defun kill-this-buffer-enabled-p ()
  "Return non-nil if the `kill-this-buffer' menu item should be enabled.
It should be enabled there is at least one non-hidden buffer, or if
`menu-bar-close-window' is non-nil and there is more than one window on
this frame."
  (or (not (menu-bar-non-minibuffer-window-p))
      (let (found-1)
	;; Instead of looping over entire buffer list, stop once we've
	;; found two "killable" buffers (Bug#8184).
	(catch 'found-2
	  (dolist (buffer (buffer-list))
	    (unless (string-match-p "^ " (buffer-name buffer))
	      (if (not found-1)
		  (setq found-1 t)
		(throw 'found-2 t))))))
      (and menu-bar-close-window
           (window-parent (selected-window)))))