1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

(delete-frame-enabled-p): New subroutine.

Use frame-visible-p to reduce consing.
This commit is contained in:
Karl Heuer 1995-05-24 01:02:08 +00:00
parent ccc06dcce5
commit 82a7410763

View File

@ -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))