changeset 11891:937c7fced6ee

(delete-frame-enabled-p): New subroutine. Use frame-visible-p to reduce consing.
author Karl Heuer <kwzh@gnu.org>
date Wed, 24 May 1995 01:02:08 +0000
parents 543a76aa50b9
children 6be0b7a0ac44
files lisp/menu-bar.el
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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))