comparison lisp/prim/frame.el @ 151:59463afc5666 r20-3b2

Import from CVS: tag r20-3b2
author cvs
date Mon, 13 Aug 2007 09:37:19 +0200
parents b980b6286996
children 0132846995bd
comparison
equal deleted inserted replaced
150:8ebb1c0f0f6f 151:59463afc5666
835 (save-excursion (set-buffer buffer) 835 (save-excursion (set-buffer buffer)
836 major-mode)))) 836 major-mode))))
837 (or (get mode 'frame-name) 837 (or (get mode 'frame-name)
838 get-frame-for-buffer-default-frame-name))) 838 get-frame-for-buffer-default-frame-name)))
839 839
840 840 (defun get-frame-for-buffer-make-new-frame (buffer &optional frame-name plist)
841 (defun get-frame-for-buffer-make-new-frame (buffer &optional frame-name) 841 (let* ((fr (make-frame plist))
842 (let* ((fr (make-frame (and frame-name (list (cons 'name frame-name)))))
843 (w (frame-root-window fr))) 842 (w (frame-root-window fr)))
844 ;; 843 ;;
845 ;; Make the one buffer being displayed in this newly created 844 ;; Make the one buffer being displayed in this newly created
846 ;; frame be the buffer of interest, instead of something 845 ;; frame be the buffer of interest, instead of something
847 ;; random, so that it won't be shown in two-window mode. 846 ;; random, so that it won't be shown in two-window mode.
872 ;; 871 ;;
873 ;; This buffer's mode expressed a preference for a frame of a particular 872 ;; This buffer's mode expressed a preference for a frame of a particular
874 ;; name. That always takes priority. 873 ;; name. That always takes priority.
875 ;; 874 ;;
876 (let ((limit (get name 'instance-limit)) 875 (let ((limit (get name 'instance-limit))
876 (defaults (get name 'frame-defaults))
877 (matching-frames '()) 877 (matching-frames '())
878 frames frame already-visible) 878 frames frame already-visible)
879 ;; Sort the list so that iconic frames will be found last. They 879 ;; Sort the list so that iconic frames will be found last. They
880 ;; will be used too, but mapped frames take precedence. And 880 ;; will be used too, but mapped frames take precedence. And
881 ;; fully visible frames come before occluded frames. 881 ;; fully visible frames come before occluded frames.
909 (cond (already-visible 909 (cond (already-visible
910 already-visible) 910 already-visible)
911 ((or (null matching-frames) 911 ((or (null matching-frames)
912 (eq limit 0) ; means create with reckless abandon 912 (eq limit 0) ; means create with reckless abandon
913 (and limit (< (length matching-frames) limit))) 913 (and limit (< (length matching-frames) limit)))
914 (get-frame-for-buffer-make-new-frame buffer name)) 914 (get-frame-for-buffer-make-new-frame
915 buffer
916 name
917 (alist-to-plist (acons 'name name
918 (plist-to-alist defaults)))))
915 (t 919 (t
916 ;; do not switch any of the window/buffer associations in an 920 ;; do not switch any of the window/buffer associations in an
917 ;; existing frame; this function only picks a frame; the 921 ;; existing frame; this function only picks a frame; the
918 ;; determination of which windows on it get reused is up to 922 ;; determination of which windows on it get reused is up to
919 ;; display-buffer itself. 923 ;; display-buffer itself.