# HG changeset patch # User Karl Heuer # Date 801277328 0 # Node ID 937c7fced6eed90f71fddfbf48e9cf99fe46e265 # Parent 543a76aa50b9b617c08e98eadde7d74ad5a7efc8 (delete-frame-enabled-p): New subroutine. Use frame-visible-p to reduce consing. diff -r 543a76aa50b9 -r 937c7fced6ee lisp/menu-bar.el --- a/lisp/menu-bar.el Wed May 24 00:46:17 1995 +0000 +++ b/lisp/menu-bar.el Wed May 24 01:02:08 1995 +0000 @@ -355,15 +355,20 @@ (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))