comparison lisp/frame.el @ 31450:82556406aa45

(filtered-frame-list): Reduce consing. (frames-on-display-list): Call frame-parameter instead of frame-parameters.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 07 Sep 2000 11:39:07 +0000
parents 503d71e95620
children 716c4876654b
comparison
equal deleted inserted replaced
31449:8797df6a9fa2 31450:82556406aa45
492 (run-hook-with-args 'after-make-frame-functions frame) 492 (run-hook-with-args 'after-make-frame-functions frame)
493 frame)) 493 frame))
494 494
495 (defun filtered-frame-list (predicate) 495 (defun filtered-frame-list (predicate)
496 "Return a list of all live frames which satisfy PREDICATE." 496 "Return a list of all live frames which satisfy PREDICATE."
497 (let ((frames (frame-list)) 497 (let* ((frames (frame-list))
498 good-frames) 498 (list frames))
499 (while (consp frames) 499 (while (consp frames)
500 (if (funcall predicate (car frames)) 500 (unless (funcall predicate (car frames))
501 (setq good-frames (cons (car frames) good-frames))) 501 (setcar frames nil))
502 (setq frames (cdr frames))) 502 (setq frames (cdr frames)))
503 good-frames)) 503 (delq nil list)))
504 504
505 (defun minibuffer-frame-list () 505 (defun minibuffer-frame-list ()
506 "Return a list of all frames with their own minibuffers." 506 "Return a list of all frames with their own minibuffers."
507 (filtered-frame-list 507 (filtered-frame-list
508 (function (lambda (frame) 508 (function (lambda (frame)
510 510
511 (defun frames-on-display-list (&optional display) 511 (defun frames-on-display-list (&optional display)
512 "Return a list of all frames on DISPLAY. 512 "Return a list of all frames on DISPLAY.
513 DISPLAY is a name of a display, a string of the form HOST:SERVER.SCREEN. 513 DISPLAY is a name of a display, a string of the form HOST:SERVER.SCREEN.
514 If DISPLAY is omitted or nil, it defaults to the selected frame's display." 514 If DISPLAY is omitted or nil, it defaults to the selected frame's display."
515 (let* ((display (or display 515 (let* ((display (or display (frame-parameter nil 'display)))
516 (cdr (assoc 'display (frame-parameters))))) 516 (func #'(lambda (frame)
517 (func 517 (eq (frame-parameter frame 'display) display))))
518 (function (lambda (frame)
519 (eq (cdr (assoc 'display (frame-parameters frame)))
520 display)))))
521 (filtered-frame-list func))) 518 (filtered-frame-list func)))
522 519
523 (defun framep-on-display (&optional display) 520 (defun framep-on-display (&optional display)
524 "Return the type of frames on DISPLAY. 521 "Return the type of frames on DISPLAY.
525 DISPLAY may be a display name or a frame. If it is a frame, its type is 522 DISPLAY may be a display name or a frame. If it is a frame, its type is