From 82a74107638f35cca4bbcea79f46daed8067a052 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Wed, 24 May 1995 01:02:08 +0000 Subject: [PATCH] (delete-frame-enabled-p): New subroutine. Use frame-visible-p to reduce consing. --- lisp/menu-bar.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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)) -- 2.39.2