From: Karl Heuer Date: Wed, 24 May 1995 01:02:08 +0000 (+0000) Subject: (delete-frame-enabled-p): New subroutine. X-Git-Tag: emacs-19.34~3967 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=82a74107638f35cca4bbcea79f46daed8067a052;p=emacs.git (delete-frame-enabled-p): New subroutine. Use frame-visible-p to reduce consing. --- diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 08c909170ac..a49370fd52e 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -355,15 +355,20 @@ Do the same for the keys of the same name." (and (buffer-file-name) (or (buffer-modified-p) (not (verify-visited-file-modtime (current-buffer))))))) + ;; Permit deleting frame if it would leave a visible or iconified frame. (put 'delete-frame 'menu-enable - '(let ((frames (frame-list)) - (count 0)) - (while frames - (if (cdr (assq 'visibility (frame-parameters (car frames)))) - (setq count (1+ count))) - (setq frames (cdr frames))) - (> count 1))) + '(delete-frame-enabled-p)) + +(defun delete-frame-enabled-p () + "Return non-nil if `delete-frame' should be enabled in the menu bar." + (let ((frames (frame-list)) + (count 0)) + (while frames + (if (frame-visible-p (car frames)) + (setq count (1+ count))) + (setq frames (cdr frames))) + (> count 1))) (put 'advertised-undo 'menu-enable '(and (not (eq t buffer-undo-list))