aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-05-13 03:24:09 +0000
committerRichard M. Stallman1993-05-13 03:24:09 +0000
commite09c52a8a05420a0ca150a4166826febb0dacac1 (patch)
treed47f3b8fc9064581f52193c5dbe815931e91bd42
parentfc4d4afb41a8d1f2daac309ffd1d313352e405ec (diff)
downloademacs-e09c52a8a05420a0ca150a4166826febb0dacac1.tar.gz
emacs-e09c52a8a05420a0ca150a4166826febb0dacac1.zip
(face-initialize): New function.
All initialization code moved into it. Call at end of file, if using X frames already. (x-create-frame-with-faces): Don't use faces if not initialized.
-rw-r--r--lisp/faces.el82
1 files changed, 44 insertions, 38 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index 39e56f0cbaa..28323f5d737 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -604,8 +604,7 @@ If NOERROR is non-nil, return nil on failure."
604;;; Make the builtin faces; the C code knows these as faces 0, 1, and 2, 604;;; Make the builtin faces; the C code knows these as faces 0, 1, and 2,
605;;; respectively, so they must be the first three faces made. 605;;; respectively, so they must be the first three faces made.
606 606
607(if (internal-find-face 'default) 607(defun face-initialize ()
608 nil
609 (make-face 'default) 608 (make-face 'default)
610 (make-face 'modeline) 609 (make-face 'modeline)
611 (make-face 'highlight) 610 (make-face 'highlight)
@@ -617,7 +616,15 @@ If NOERROR is non-nil, return nil on failure."
617 (make-face 'italic) 616 (make-face 'italic)
618 (make-face 'bold-italic) 617 (make-face 'bold-italic)
619 (make-face 'primary-selection) 618 (make-face 'primary-selection)
620 (make-face 'secondary-selection)) 619 (make-face 'secondary-selection)
620
621 ;; Set up the faces of all existing X Window frames.
622 (let ((frames (frame-list)))
623 (while frames
624 (if (eq (framep (car frames)) 'x)
625 (x-initialize-frame-faces (car frames)))
626 (setq frames (cdr frames)))))
627
621 628
622;;; This really belongs in setting a frame's own font. 629;;; This really belongs in setting a frame's own font.
623;;; ;; 630;;; ;;
@@ -714,41 +721,40 @@ If NOERROR is non-nil, return nil on failure."
714;; Like x-create-frame but also set up the faces. 721;; Like x-create-frame but also set up the faces.
715 722
716(defun x-create-frame-with-faces (&optional parameters) 723(defun x-create-frame-with-faces (&optional parameters)
717 (let* ((frame (x-create-frame parameters)) 724 (if (null global-face-data)
718 (faces (copy-alist global-face-data)) 725 (x-create-frame parameters)
719 (rest faces) 726 (let* ((frame (x-create-frame parameters))
720 default modeline) 727 (faces (copy-alist global-face-data))
721 (set-frame-face-alist frame faces) 728 (rest faces)
722 729 default modeline)
723 ;; Copy the vectors that represent the faces. 730 (set-frame-face-alist frame faces)
724 ;; Also fill them in from X resources. 731
725 (while rest 732 ;; Copy the vectors that represent the faces.
726 (setcdr (car rest) (copy-sequence (cdr (car rest)))) 733 ;; Also fill them in from X resources.
727 (make-face-x-resource-internal (cdr (car rest)) frame t) 734 (while rest
728 (setq rest (cdr rest))) 735 (setcdr (car rest) (copy-sequence (cdr (car rest))))
729 736 (make-face-x-resource-internal (cdr (car rest)) frame t)
730 (setq default (internal-get-face 'default frame) 737 (setq rest (cdr rest)))
731 modeline (internal-get-face 'modeline frame)) 738
732 739 (setq default (internal-get-face 'default frame)
733 (x-initialize-frame-faces frame) 740 modeline (internal-get-face 'modeline frame))
734 741
735;;; ;; Make sure the modeline face is fully qualified. 742 (x-initialize-frame-faces frame)
736;;; (if (and (not (face-font modeline frame)) (face-font default frame)) 743
737;;; (set-face-font modeline (face-font default frame) frame)) 744 ;;; ;; Make sure the modeline face is fully qualified.
738;;; (if (and (not (face-background modeline frame)) 745 ;;; (if (and (not (face-font modeline frame)) (face-font default frame))
739;;; (face-background default frame)) 746 ;;; (set-face-font modeline (face-font default frame) frame))
740;;; (set-face-background modeline (face-background default frame) frame)) 747 ;;; (if (and (not (face-background modeline frame))
741;;; (if (and (not (face-foreground modeline frame)) 748 ;;; (face-background default frame))
742;;; (face-foreground default frame)) 749 ;;; (set-face-background modeline (face-background default frame) frame))
743;;; (set-face-foreground modeline (face-foreground default frame) frame)) 750 ;;; (if (and (not (face-foreground modeline frame))
744 frame)) 751 ;;; (face-foreground default frame))
745 752 ;;; (set-face-foreground modeline (face-foreground default frame) frame))
746;; Set up the faces of all existing frames. 753 frame)))
747(let ((frames (frame-list))) 754
748 (while frames 755;; If we are already using x-window frames, initialize faces for them.
749 (if (eq (framep (car frames)) 'x) 756(if (eq (framep (selected-frame)) 'x)
750 (x-initialize-frame-faces (car frames))) 757 (face-initialize))
751 (setq frames (cdr frames))))
752 758
753(provide 'faces) 759(provide 'faces)
754 760