Mercurial > emacs
annotate lisp/faces.el @ 4543:929e4c850e76
(term_get_fkeys_define_1, term_get_fkeys_define): New functions.
(term_get_fkeys): Use them.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 11 Aug 1993 04:09:28 +0000 |
parents | e7ab04f23df5 |
children | 62564c5e2df7 |
rev | line source |
---|---|
2456 | 1 ;;; faces.el --- Lisp interface to the c "face" structure |
2 | |
3 ;; Copyright (C) 1992, 1993 Free Software Foundation, Inc. | |
4 | |
5 ;; This file is part of GNU Emacs. | |
6 | |
7 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
8 ;; it under the terms of the GNU General Public License as published by | |
9 ;; the Free Software Foundation; either version 2, or (at your option) | |
10 ;; any later version. | |
11 | |
12 ;; GNU Emacs is distributed in the hope that it will be useful, | |
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 ;; GNU General Public License for more details. | |
16 | |
17 ;; You should have received a copy of the GNU General Public License | |
18 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
19 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | |
21 ;;; Commentary: | |
22 | |
23 ;; Mostly derived from Lucid. | |
24 | |
25 ;;; Code: | |
26 | |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
27 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
28 ;;;; Functions for manipulating face vectors. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
29 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
30 ;;; A face vector is a vector of the form: |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
31 ;;; [face ID FONT FOREGROUND BACKGROUND BACKGROUND-PIXMAP UNDERLINE] |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
32 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
33 ;;; Type checkers. |
2456 | 34 (defsubst internal-facep (x) |
35 (and (vectorp x) (= (length x) 8) (eq (aref x 0) 'face))) | |
36 | |
37 (defmacro internal-check-face (face) | |
38 (` (while (not (internal-facep (, face))) | |
39 (setq (, face) (signal 'wrong-type-argument (list 'internal-facep (, face))))))) | |
40 | |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
41 ;;; Accessors. |
2456 | 42 (defsubst face-name (face) |
43 "Return the name of face FACE." | |
44 (aref (internal-get-face face) 1)) | |
45 | |
46 (defsubst face-id (face) | |
47 "Return the internal ID number of face FACE." | |
48 (aref (internal-get-face face) 2)) | |
49 | |
50 (defsubst face-font (face &optional frame) | |
51 "Return the font name of face FACE, or nil if it is unspecified. | |
52 If the optional argument FRAME is given, report on face FACE in that frame. | |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
53 If FRAME is t, report on the defaults for face FACE (for new frames). |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
54 The font default for a face is either nil, or a list |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
55 of the form (bold), (italic) or (bold italic). |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
56 If FRAME is omitted or nil, use the selected frame." |
2456 | 57 (aref (internal-get-face face frame) 3)) |
58 | |
59 (defsubst face-foreground (face &optional frame) | |
60 "Return the foreground color name of face FACE, or nil if unspecified. | |
61 If the optional argument FRAME is given, report on face FACE in that frame. | |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
62 If FRAME is t, report on the defaults for face FACE (for new frames). |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
63 If FRAME is omitted or nil, use the selected frame." |
2456 | 64 (aref (internal-get-face face frame) 4)) |
65 | |
66 (defsubst face-background (face &optional frame) | |
67 "Return the background color name of face FACE, or nil if unspecified. | |
68 If the optional argument FRAME is given, report on face FACE in that frame. | |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
69 If FRAME is t, report on the defaults for face FACE (for new frames). |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
70 If FRAME is omitted or nil, use the selected frame." |
2456 | 71 (aref (internal-get-face face frame) 5)) |
72 | |
3812
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
73 ;;(defsubst face-background-pixmap (face &optional frame) |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
74 ;; "Return the background pixmap name of face FACE, or nil if unspecified. |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
75 ;;If the optional argument FRAME is given, report on face FACE in that frame. |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
76 ;;Otherwise report on the defaults for face FACE (for new frames)." |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
77 ;; (aref (internal-get-face face frame) 6)) |
2456 | 78 |
79 (defsubst face-underline-p (face &optional frame) | |
80 "Return t if face FACE is underlined. | |
81 If the optional argument FRAME is given, report on face FACE in that frame. | |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
82 If FRAME is t, report on the defaults for face FACE (for new frames). |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
83 If FRAME is omitted or nil, use the selected frame." |
2456 | 84 (aref (internal-get-face face frame) 7)) |
85 | |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
86 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
87 ;;; Mutators. |
2456 | 88 |
89 (defsubst set-face-font (face font &optional frame) | |
90 "Change the font of face FACE to FONT (a string). | |
91 If the optional FRAME argument is provided, change only | |
92 in that frame; otherwise change each frame." | |
93 (interactive (internal-face-interactive "font")) | |
3130
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
94 (if (stringp font) (setq font (x-resolve-font-name font face frame))) |
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
95 (internal-set-face-1 face 'font font 3 frame)) |
2456 | 96 |
97 (defsubst set-face-foreground (face color &optional frame) | |
98 "Change the foreground color of face FACE to COLOR (a string). | |
99 If the optional FRAME argument is provided, change only | |
100 in that frame; otherwise change each frame." | |
101 (interactive (internal-face-interactive "foreground")) | |
2715
9caee9338229
* faces.el: Call internal-set-face-1, not internat-set-face-1.
Jim Blandy <jimb@redhat.com>
parents:
2714
diff
changeset
|
102 (internal-set-face-1 face 'foreground color 4 frame)) |
2456 | 103 |
104 (defsubst set-face-background (face color &optional frame) | |
105 "Change the background color of face FACE to COLOR (a string). | |
106 If the optional FRAME argument is provided, change only | |
107 in that frame; otherwise change each frame." | |
108 (interactive (internal-face-interactive "background")) | |
2715
9caee9338229
* faces.el: Call internal-set-face-1, not internat-set-face-1.
Jim Blandy <jimb@redhat.com>
parents:
2714
diff
changeset
|
109 (internal-set-face-1 face 'background color 5 frame)) |
2456 | 110 |
3812
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
111 ;;(defsubst set-face-background-pixmap (face name &optional frame) |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
112 ;; "Change the background pixmap of face FACE to PIXMAP. |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
113 ;;PIXMAP should be a string, the name of a file of pixmap data. |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
114 ;;The directories listed in the `x-bitmap-file-path' variable are searched. |
2456 | 115 |
3812
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
116 ;;Alternatively, PIXMAP may be a list of the form (WIDTH HEIGHT DATA) |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
117 ;;where WIDTH and HEIGHT are the size in pixels, |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
118 ;;and DATA is a string, containing the raw bits of the bitmap. |
2456 | 119 |
3812
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
120 ;;If the optional FRAME argument is provided, change only |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
121 ;;in that frame; otherwise change each frame." |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
122 ;; (interactive (internal-face-interactive "background-pixmap")) |
0bc757649dd7
(set-face-background-pixmap, face-background-pixmap): Functions commented out.
Richard M. Stallman <rms@gnu.org>
parents:
3555
diff
changeset
|
123 ;; (internal-set-face-1 face 'background-pixmap name 6 frame)) |
2456 | 124 |
125 (defsubst set-face-underline-p (face underline-p &optional frame) | |
126 "Specify whether face FACE is underlined. (Yes if UNDERLINE-P is non-nil.) | |
127 If the optional FRAME argument is provided, change only | |
128 in that frame; otherwise change each frame." | |
129 (interactive (internal-face-interactive "underline-p" "underlined")) | |
2715
9caee9338229
* faces.el: Call internal-set-face-1, not internat-set-face-1.
Jim Blandy <jimb@redhat.com>
parents:
2714
diff
changeset
|
130 (internal-set-face-1 face 'underline underline-p 7 frame)) |
2456 | 131 |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
132 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
133 ;;;; Associating face names (symbols) with their face vectors. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
134 |
3925
f286657c098e
* faces.el (global-face-data): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
3911
diff
changeset
|
135 (defvar global-face-data nil |
f286657c098e
* faces.el (global-face-data): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
3911
diff
changeset
|
136 "Internal data for face support functions. Not for external use. |
f286657c098e
* faces.el (global-face-data): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
3911
diff
changeset
|
137 This is an alist associating face names with the default values for |
f286657c098e
* faces.el (global-face-data): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
3911
diff
changeset
|
138 their parameters. Newly created frames get their data from here.") |
f286657c098e
* faces.el (global-face-data): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
3911
diff
changeset
|
139 |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
140 (defun face-list () |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
141 "Returns a list of all defined face names." |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
142 (mapcar 'car global-face-data)) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
143 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
144 (defun internal-find-face (name &optional frame) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
145 "Retrieve the face named NAME. Return nil if there is no such face. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
146 If the optional argument FRAME is given, this gets the face NAME for |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
147 that frame; otherwise, it uses the selected frame. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
148 If FRAME is the symbol t, then the global, non-frame face is returned. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
149 If NAME is already a face, it is simply returned." |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
150 (if (and (eq frame t) (not (symbolp name))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
151 (setq name (face-name name))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
152 (if (symbolp name) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
153 (cdr (assq name |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
154 (if (eq frame t) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
155 global-face-data |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
156 (frame-face-alist (or frame (selected-frame)))))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
157 (internal-check-face name) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
158 name)) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
159 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
160 (defun internal-get-face (name &optional frame) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
161 "Retrieve the face named NAME; error if there is none. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
162 If the optional argument FRAME is given, this gets the face NAME for |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
163 that frame; otherwise, it uses the selected frame. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
164 If FRAME is the symbol t, then the global, non-frame face is returned. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
165 If NAME is already a face, it is simply returned." |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
166 (or (internal-find-face name frame) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
167 (internal-check-face name))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
168 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
169 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
170 (defun internal-set-face-1 (face name value index frame) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
171 (let ((inhibit-quit t)) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
172 (if (null frame) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
173 (let ((frames (frame-list))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
174 (while frames |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
175 (internal-set-face-1 (face-name face) name value index (car frames)) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
176 (setq frames (cdr frames))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
177 (aset (internal-get-face (if (symbolp face) face (face-name face)) t) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
178 index value) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
179 value) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
180 (or (eq frame t) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
181 (set-face-attribute-internal (face-id face) name value frame)) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
182 (aset (internal-get-face face frame) index value)))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
183 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
184 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
185 (defun read-face-name (prompt) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
186 (let (face) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
187 (while (= (length face) 0) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
188 (setq face (completing-read prompt |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
189 (mapcar '(lambda (x) (list (symbol-name x))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
190 (face-list)) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
191 nil t))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
192 (intern face))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
193 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
194 (defun internal-face-interactive (what &optional bool) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
195 (let* ((fn (intern (concat "face-" what))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
196 (prompt (concat "Set " what " of face")) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
197 (face (read-face-name (concat prompt ": "))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
198 (default (if (fboundp fn) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
199 (or (funcall fn face (selected-frame)) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
200 (funcall fn 'default (selected-frame))))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
201 (value (if bool |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
202 (y-or-n-p (concat "Should face " (symbol-name face) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
203 " be " bool "? ")) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
204 (read-string (concat prompt " " (symbol-name face) " to: ") |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
205 default)))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
206 (list face (if (equal value "") nil value)))) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
207 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
208 |
2456 | 209 |
210 (defun make-face (name) | |
211 "Define a new FACE on all frames. | |
212 You can modify the font, color, etc of this face with the set-face- functions. | |
213 If the face already exists, it is unmodified." | |
3001
c6c6e476d93d
* faces.el (make-face): Change interactive spec to 'S'.
Jim Blandy <jimb@redhat.com>
parents:
2906
diff
changeset
|
214 (interactive "SMake face: ") |
2456 | 215 (or (internal-find-face name) |
216 (let ((face (make-vector 8 nil))) | |
217 (aset face 0 'face) | |
218 (aset face 1 name) | |
219 (let* ((frames (frame-list)) | |
220 (inhibit-quit t) | |
221 (id (internal-next-face-id))) | |
222 (make-face-internal id) | |
223 (aset face 2 id) | |
224 (while frames | |
225 (set-frame-face-alist (car frames) | |
226 (cons (cons name (copy-sequence face)) | |
227 (frame-face-alist (car frames)))) | |
228 (setq frames (cdr frames))) | |
229 (setq global-face-data (cons (cons name face) global-face-data))) | |
230 ;; when making a face after frames already exist | |
231 (if (eq window-system 'x) | |
232 (make-face-x-resource-internal face)) | |
233 face))) | |
234 | |
235 ;; Fill in a face by default based on X resources, for all existing frames. | |
236 ;; This has to be done when a new face is made. | |
237 (defun make-face-x-resource-internal (face &optional frame set-anyway) | |
238 (cond ((null frame) | |
239 (let ((frames (frame-list))) | |
240 (while frames | |
241 (make-face-x-resource-internal (face-name face) | |
242 (car frames) set-anyway) | |
243 (setq frames (cdr frames))))) | |
244 (t | |
245 (setq face (internal-get-face (face-name face) frame)) | |
246 ;; | |
247 ;; These are things like "attributeForeground" instead of simply | |
248 ;; "foreground" because people tend to do things like "*foreground", | |
249 ;; which would cause all faces to be fully qualified, making faces | |
250 ;; inherit attributes in a non-useful way. So we've made them slightly | |
251 ;; less obvious to specify in order to make them work correctly in | |
252 ;; more random environments. | |
253 ;; | |
254 ;; I think these should be called "face.faceForeground" instead of | |
255 ;; "face.attributeForeground", but they're the way they are for | |
256 ;; hysterical reasons. | |
257 ;; | |
258 (let* ((name (symbol-name (face-name face))) | |
259 (fn (or (x-get-resource (concat name ".attributeFont") | |
260 "Face.AttributeFont") | |
261 (and set-anyway (face-font face)))) | |
262 (fg (or (x-get-resource (concat name ".attributeForeground") | |
263 "Face.AttributeForeground") | |
264 (and set-anyway (face-foreground face)))) | |
265 (bg (or (x-get-resource (concat name ".attributeBackground") | |
266 "Face.AttributeBackground") | |
267 (and set-anyway (face-background face)))) | |
268 ;; (bgp (or (x-get-resource (concat name ".attributeBackgroundPixmap") | |
269 ;; "Face.AttributeBackgroundPixmap") | |
270 ;; (and set-anyway (face-background-pixmap face)))) | |
271 (ulp (or (x-get-resource (concat name ".attributeUnderline") | |
272 "Face.AttributeUnderline") | |
273 (and set-anyway (face-underline-p face)))) | |
274 ) | |
275 (if fn | |
276 (condition-case () | |
277 (set-face-font face fn frame) | |
278 (error (message "font `%s' not found for face `%s'" fn name)))) | |
279 (if fg | |
280 (condition-case () | |
281 (set-face-foreground face fg frame) | |
282 (error (message "color `%s' not allocated for face `%s'" fg name)))) | |
283 (if bg | |
284 (condition-case () | |
285 (set-face-background face bg frame) | |
286 (error (message "color `%s' not allocated for face `%s'" bg name)))) | |
287 ;; (if bgp | |
288 ;; (condition-case () | |
289 ;; (set-face-background-pixmap face bgp frame) | |
290 ;; (error (message "pixmap `%s' not found for face `%s'" bgp name)))) | |
291 (if (or ulp set-anyway) | |
292 (set-face-underline-p face ulp frame)) | |
293 ))) | |
294 face) | |
295 | |
4083
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
296 (defun copy-face (old-face new-name &optional frame new-frame) |
2456 | 297 "Define a face just like OLD-FACE, with name NEW-NAME. |
298 If NEW-NAME already exists as a face, it is modified to be like OLD-FACE. | |
299 If the optional argument FRAME is given, this applies only to that frame. | |
4083
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
300 Otherwise it applies to each frame separately. |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
301 If the optional fourth argument NEW-FRAME is given, |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
302 copy the information from face OLD-FACE on frame FRAME |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
303 to face NEW-NAME on frame NEW-FRAME." |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
304 (or new-frame (setq new-frame frame)) |
2456 | 305 (setq old-face (internal-get-face old-face frame)) |
306 (let* ((inhibit-quit t) | |
4083
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
307 (new-face (or (internal-find-face new-name new-frame) |
2456 | 308 (make-face new-name)))) |
309 (if (null frame) | |
310 (let ((frames (frame-list))) | |
311 (while frames | |
312 (copy-face old-face new-name (car frames)) | |
313 (setq frames (cdr frames))) | |
314 (copy-face old-face new-name t)) | |
4083
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
315 (set-face-font new-face (face-font old-face frame) new-frame) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
316 (set-face-foreground new-face (face-foreground old-face frame) new-frame) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
317 (set-face-background new-face (face-background old-face frame) new-frame) |
2800
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
318 ;;; (set-face-background-pixmap |
4083
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
319 ;;; new-face (face-background-pixmap old-face frame) new-frame) |
2456 | 320 (set-face-underline-p new-face (face-underline-p old-face frame) |
4083
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
321 new-frame)) |
2456 | 322 new-face)) |
323 | |
324 (defun face-equal (face1 face2 &optional frame) | |
2906
ca9bf00d4b19
* xfaces.el (face-equal): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
2826
diff
changeset
|
325 "True if the faces FACE1 and FACE2 display in the same way." |
2456 | 326 (setq face1 (internal-get-face face1 frame) |
327 face2 (internal-get-face face2 frame)) | |
328 (and (equal (face-foreground face1 frame) (face-foreground face2 frame)) | |
329 (equal (face-background face1 frame) (face-background face2 frame)) | |
330 (equal (face-font face1 frame) (face-font face2 frame)) | |
4122
82f0b478a551
(face-equal): Don't mess with face-background-pixmap.
Richard M. Stallman <rms@gnu.org>
parents:
4083
diff
changeset
|
331 ;; (equal (face-background-pixmap face1 frame) |
82f0b478a551
(face-equal): Don't mess with face-background-pixmap.
Richard M. Stallman <rms@gnu.org>
parents:
4083
diff
changeset
|
332 ;; (face-background-pixmap face2 frame)) |
82f0b478a551
(face-equal): Don't mess with face-background-pixmap.
Richard M. Stallman <rms@gnu.org>
parents:
4083
diff
changeset
|
333 )) |
2456 | 334 |
335 (defun face-differs-from-default-p (face &optional frame) | |
336 "True if face FACE displays differently from the default face, on FRAME. | |
337 A face is considered to be ``the same'' as the default face if it is | |
338 actually specified in the same way (equivalent fonts, etc) or if it is | |
339 fully unspecified, and thus inherits the attributes of any face it | |
340 is displayed on top of." | |
341 (let ((default (internal-get-face 'default frame))) | |
342 (setq face (internal-get-face face frame)) | |
343 (not (and (or (equal (face-foreground default frame) | |
344 (face-foreground face frame)) | |
345 (null (face-foreground face frame))) | |
346 (or (equal (face-background default frame) | |
347 (face-background face frame)) | |
348 (null (face-background face frame))) | |
349 (or (equal (face-font default frame) (face-font face frame)) | |
350 (null (face-font face frame))) | |
2800
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
351 ;;; (or (equal (face-background-pixmap default frame) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
352 ;;; (face-background-pixmap face frame)) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
353 ;;; (null (face-background-pixmap face frame))) |
2456 | 354 (equal (face-underline-p default frame) |
355 (face-underline-p face frame)) | |
356 )))) | |
357 | |
358 | |
359 (defun invert-face (face &optional frame) | |
360 "Swap the foreground and background colors of face FACE. | |
361 If the face doesn't specify both foreground and background, then | |
2800
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
362 set its foreground and background to the default background and foreground." |
2456 | 363 (interactive (list (read-face-name "Invert face: "))) |
364 (setq face (internal-get-face face frame)) | |
365 (let ((fg (face-foreground face frame)) | |
366 (bg (face-background face frame))) | |
367 (if (or fg bg) | |
368 (progn | |
369 (set-face-foreground face bg frame) | |
370 (set-face-background face fg frame)) | |
2800
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
371 (set-face-foreground face (or (face-background 'default frame) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
372 (cdr (assq 'background-color (frame-parameters frame)))) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
373 frame) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
374 (set-face-background face (or (face-foreground 'default frame) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
375 (cdr (assq 'foreground-color (frame-parameters frame)))) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
376 frame))) |
2456 | 377 face) |
378 | |
379 | |
380 (defun internal-try-face-font (face font &optional frame) | |
381 "Like set-face-font, but returns nil on failure instead of an error." | |
382 (condition-case () | |
383 (set-face-font face font frame) | |
384 (error nil))) | |
385 | |
386 ;; Manipulating font names. | |
387 | |
388 (defconst x-font-regexp nil) | |
389 (defconst x-font-regexp-head nil) | |
390 (defconst x-font-regexp-weight nil) | |
391 (defconst x-font-regexp-slant nil) | |
392 | |
393 ;;; Regexps matching font names in "Host Portable Character Representation." | |
394 ;;; | |
395 (let ((- "[-?]") | |
396 (foundry "[^-]+") | |
397 (family "[^-]+") | |
398 (weight "\\(bold\\|demibold\\|medium\\)") ; 1 | |
399 ; (weight\? "\\(\\*\\|bold\\|demibold\\|medium\\|\\)") ; 1 | |
400 (weight\? "\\([^-]*\\)") ; 1 | |
401 (slant "\\([ior]\\)") ; 2 | |
402 ; (slant\? "\\([ior?*]?\\)") ; 2 | |
403 (slant\? "\\([^-]?\\)") ; 2 | |
404 ; (swidth "\\(\\*\\|normal\\|semicondensed\\|\\)") ; 3 | |
405 (swidth "\\([^-]*\\)") ; 3 | |
406 ; (adstyle "\\(\\*\\|sans\\|\\)") ; 4 | |
407 (adstyle "[^-]*") ; 4 | |
408 (pixelsize "[0-9]+") | |
409 (pointsize "[0-9][0-9]+") | |
410 (resx "[0-9][0-9]+") | |
411 (resy "[0-9][0-9]+") | |
412 (spacing "[cmp?*]") | |
413 (avgwidth "[0-9]+") | |
414 (registry "[^-]+") | |
415 (encoding "[^-]+") | |
416 ) | |
417 (setq x-font-regexp | |
418 (concat "\\`\\*?[-?*]" | |
419 foundry - family - weight\? - slant\? - swidth - adstyle - | |
420 pixelsize - pointsize - resx - resy - spacing - registry - | |
421 encoding "[-?*]\\*?\\'" | |
422 )) | |
423 (setq x-font-regexp-head | |
424 (concat "\\`[-?*]" foundry - family - weight\? - slant\? | |
425 "\\([-*?]\\|\\'\\)")) | |
426 (setq x-font-regexp-slant (concat - slant -)) | |
427 (setq x-font-regexp-weight (concat - weight -)) | |
428 nil) | |
429 | |
3071
68de05fb5751
* faces.el (set-face-font): Call x-resolve-font-name on the font
Jim Blandy <jimb@redhat.com>
parents:
3049
diff
changeset
|
430 (defun x-resolve-font-name (pattern &optional face frame) |
68de05fb5751
* faces.el (set-face-font): Call x-resolve-font-name on the font
Jim Blandy <jimb@redhat.com>
parents:
3049
diff
changeset
|
431 "Return a font name matching PATTERN. |
68de05fb5751
* faces.el (set-face-font): Call x-resolve-font-name on the font
Jim Blandy <jimb@redhat.com>
parents:
3049
diff
changeset
|
432 All wildcards in PATTERN become substantiated. |
3130
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
433 If PATTERN is nil, return the name of the frame's base font, which never |
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
434 contains wildcards. |
3071
68de05fb5751
* faces.el (set-face-font): Call x-resolve-font-name on the font
Jim Blandy <jimb@redhat.com>
parents:
3049
diff
changeset
|
435 Given optional arguments FACE and FRAME, try to return a font which is |
3130
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
436 also the same size as FACE on FRAME." |
3233
28b2df35c33e
(x-resolve-font-name): Allow symbol as FACE arg.
Richard M. Stallman <rms@gnu.org>
parents:
3182
diff
changeset
|
437 (or (symbolp face) |
28b2df35c33e
(x-resolve-font-name): Allow symbol as FACE arg.
Richard M. Stallman <rms@gnu.org>
parents:
3182
diff
changeset
|
438 (setq face (face-name face))) |
28b2df35c33e
(x-resolve-font-name): Allow symbol as FACE arg.
Richard M. Stallman <rms@gnu.org>
parents:
3182
diff
changeset
|
439 (and (eq frame t) |
28b2df35c33e
(x-resolve-font-name): Allow symbol as FACE arg.
Richard M. Stallman <rms@gnu.org>
parents:
3182
diff
changeset
|
440 (setq frame nil)) |
3130
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
441 (if pattern |
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
442 (let ((fonts (x-list-fonts pattern face frame))) |
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
443 (or fonts |
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
444 (if face |
3353
8cbd38886eef
(x-resolve-font-name): Clean up error messages.
Richard M. Stallman <rms@gnu.org>
parents:
3298
diff
changeset
|
445 (error "No fonts matching pattern are the same size as `%s'" |
3298
0b96c67ca1c5
* faces.el (x-resolve-font-name): Give correct error message
Jim Blandy <jimb@redhat.com>
parents:
3297
diff
changeset
|
446 face) |
3353
8cbd38886eef
(x-resolve-font-name): Clean up error messages.
Richard M. Stallman <rms@gnu.org>
parents:
3298
diff
changeset
|
447 (error "No fonts match `%s'" pattern))) |
3130
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
448 (car fonts)) |
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
449 (cdr (assq 'font (frame-parameters (selected-frame)))))) |
3071
68de05fb5751
* faces.el (set-face-font): Call x-resolve-font-name on the font
Jim Blandy <jimb@redhat.com>
parents:
3049
diff
changeset
|
450 |
2456 | 451 (defun x-frob-font-weight (font which) |
452 (if (or (string-match x-font-regexp font) | |
453 (string-match x-font-regexp-head font) | |
454 (string-match x-font-regexp-weight font)) | |
455 (concat (substring font 0 (match-beginning 1)) which | |
456 (substring font (match-end 1))) | |
457 nil)) | |
458 | |
459 (defun x-frob-font-slant (font which) | |
460 (cond ((or (string-match x-font-regexp font) | |
461 (string-match x-font-regexp-head font)) | |
462 (concat (substring font 0 (match-beginning 2)) which | |
463 (substring font (match-end 2)))) | |
464 ((string-match x-font-regexp-slant font) | |
465 (concat (substring font 0 (match-beginning 1)) which | |
466 (substring font (match-end 1)))) | |
467 (t nil))) | |
468 | |
469 | |
470 (defun x-make-font-bold (font) | |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
471 "Given an X font specification, make a bold version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
472 If that can't be done, return nil." |
2456 | 473 (x-frob-font-weight font "bold")) |
474 | |
475 (defun x-make-font-demibold (font) | |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
476 "Given an X font specification, make a demibold version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
477 If that can't be done, return nil." |
2456 | 478 (x-frob-font-weight font "demibold")) |
479 | |
480 (defun x-make-font-unbold (font) | |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
481 "Given an X font specification, make a non-bold version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
482 If that can't be done, return nil." |
2456 | 483 (x-frob-font-weight font "medium")) |
484 | |
485 (defun x-make-font-italic (font) | |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
486 "Given an X font specification, make an italic version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
487 If that can't be done, return nil." |
2456 | 488 (x-frob-font-slant font "i")) |
489 | |
490 (defun x-make-font-oblique (font) ; you say tomayto... | |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
491 "Given an X font specification, make an oblique version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
492 If that can't be done, return nil." |
2456 | 493 (x-frob-font-slant font "o")) |
494 | |
495 (defun x-make-font-unitalic (font) | |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
496 "Given an X font specification, make a non-italic version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
497 If that can't be done, return nil." |
2456 | 498 (x-frob-font-slant font "r")) |
499 | |
500 ;;; non-X-specific interface | |
501 | |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
502 (defun make-face-bold (face &optional frame noerror) |
2456 | 503 "Make the font of the given face be bold, if possible. |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
504 If NOERROR is non-nil, return nil on failure." |
2456 | 505 (interactive (list (read-face-name "Make which face bold: "))) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
506 (if (eq frame t) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
507 (set-face-font face (if (memq 'italic (face-font face t)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
508 '(bold italic) '(bold)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
509 t) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
510 (let ((ofont (face-font face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
511 font f2) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
512 (if (null frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
513 (let ((frames (frame-list))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
514 ;; Make this face bold in global-face-data. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
515 (make-face-bold face t noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
516 ;; Make this face bold in each frame. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
517 (while frames |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
518 (make-face-bold face (car frames) noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
519 (setq frames (cdr frames)))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
520 (setq face (internal-get-face face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
521 (setq font (or (face-font face frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
522 (face-font face t))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
523 (if (listp font) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
524 (setq font nil)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
525 (setq font (or font |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
526 (face-font 'default frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
527 (cdr (assq 'font (frame-parameters frame))))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
528 (make-face-bold-internal face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
529 (or (not (equal ofont (face-font face))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
530 (and (not noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
531 (error "No bold version of %S" font)))))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
532 |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
533 (defun make-face-bold-internal (face frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
534 (or (and (setq f2 (x-make-font-bold font)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
535 (internal-try-face-font face f2 frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
536 (and (setq f2 (x-make-font-demibold font)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
537 (internal-try-face-font face f2 frame)))) |
2456 | 538 |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
539 (defun make-face-italic (face &optional frame noerror) |
2456 | 540 "Make the font of the given face be italic, if possible. |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
541 If NOERROR is non-nil, return nil on failure." |
2456 | 542 (interactive (list (read-face-name "Make which face italic: "))) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
543 (if (eq frame t) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
544 (set-face-font face (if (memq 'bold (face-font face t)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
545 '(bold italic) '(italic)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
546 t) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
547 (let ((ofont (face-font face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
548 font f2) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
549 (if (null frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
550 (let ((frames (frame-list))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
551 ;; Make this face italic in global-face-data. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
552 (make-face-italic face t noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
553 ;; Make this face italic in each frame. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
554 (while frames |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
555 (make-face-italic face (car frames) noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
556 (setq frames (cdr frames)))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
557 (setq face (internal-get-face face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
558 (setq font (or (face-font face frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
559 (face-font face t))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
560 (if (listp font) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
561 (setq font nil)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
562 (setq font (or font |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
563 (face-font 'default frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
564 (cdr (assq 'font (frame-parameters frame))))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
565 (make-face-italic-internal face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
566 (or (not (equal ofont (face-font face))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
567 (and (not noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
568 (error "No italic version of %S" font)))))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
569 |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
570 (defun make-face-italic-internal (face frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
571 (or (and (setq f2 (x-make-font-italic font)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
572 (internal-try-face-font face f2 frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
573 (and (setq f2 (x-make-font-oblique font)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
574 (internal-try-face-font face f2 frame)))) |
2456 | 575 |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
576 (defun make-face-bold-italic (face &optional frame noerror) |
2456 | 577 "Make the font of the given face be bold and italic, if possible. |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
578 If NOERROR is non-nil, return nil on failure." |
2456 | 579 (interactive (list (read-face-name "Make which face bold-italic: "))) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
580 (if (eq frame t) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
581 (set-face-font face '(bold italic) t) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
582 (let ((ofont (face-font face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
583 font) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
584 (if (null frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
585 (let ((frames (frame-list))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
586 ;; Make this face bold-italic in global-face-data. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
587 (make-face-bold-italic face t noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
588 ;; Make this face bold in each frame. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
589 (while frames |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
590 (make-face-bold-italic face (car frames) noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
591 (setq frames (cdr frames)))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
592 (setq face (internal-get-face face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
593 (setq font (or (face-font face frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
594 (face-font face t))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
595 (if (listp font) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
596 (setq font nil)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
597 (setq font (or font |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
598 (face-font 'default frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
599 (cdr (assq 'font (frame-parameters frame))))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
600 (make-face-bold-italic-internal face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
601 (or (not (equal ofont (face-font face))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
602 (and (not noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
603 (error "No bold italic version of %S" font)))))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
604 |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
605 (defun make-face-bold-italic-internal (face frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
606 (let (f2 f3) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
607 (or (and (setq f2 (x-make-font-italic font)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
608 (not (equal font f2)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
609 (setq f3 (x-make-font-bold f2)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
610 (not (equal f2 f3)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
611 (internal-try-face-font face f3 frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
612 (and (setq f2 (x-make-font-oblique font)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
613 (not (equal font f2)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
614 (setq f3 (x-make-font-bold f2)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
615 (not (equal f2 f3)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
616 (internal-try-face-font face f3 frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
617 (and (setq f2 (x-make-font-italic font)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
618 (not (equal font f2)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
619 (setq f3 (x-make-font-demibold f2)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
620 (not (equal f2 f3)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
621 (internal-try-face-font face f3 frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
622 (and (setq f2 (x-make-font-oblique font)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
623 (not (equal font f2)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
624 (setq f3 (x-make-font-demibold f2)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
625 (not (equal f2 f3)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
626 (internal-try-face-font face f3 frame))))) |
2456 | 627 |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
628 (defun make-face-unbold (face &optional frame noerror) |
2456 | 629 "Make the font of the given face be non-bold, if possible. |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
630 If NOERROR is non-nil, return nil on failure." |
2456 | 631 (interactive (list (read-face-name "Make which face non-bold: "))) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
632 (if (eq frame t) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
633 (set-face-font face (if (memq 'italic (face-font face t)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
634 '(italic) nil) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
635 t) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
636 (let ((ofont (face-font face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
637 font font1) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
638 (if (null frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
639 (let ((frames (frame-list))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
640 ;; Make this face unbold in global-face-data. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
641 (make-face-unbold face t noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
642 ;; Make this face unbold in each frame. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
643 (while frames |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
644 (make-face-unbold face (car frames) noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
645 (setq frames (cdr frames)))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
646 (setq face (internal-get-face face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
647 (setq font1 (or (face-font face frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
648 (face-font face t))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
649 (if (listp font1) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
650 (setq font1 nil)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
651 (setq font1 (or font1 |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
652 (face-font 'default frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
653 (cdr (assq 'font (frame-parameters frame))))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
654 (setq font (x-make-font-unbold font1)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
655 (if font (internal-try-face-font face font frame))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
656 (or (not (equal ofont (face-font face))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
657 (and (not noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
658 (error "No unbold version of %S" font1)))))) |
2456 | 659 |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
660 (defun make-face-unitalic (face &optional frame noerror) |
2456 | 661 "Make the font of the given face be non-italic, if possible. |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
662 If NOERROR is non-nil, return nil on failure." |
2456 | 663 (interactive (list (read-face-name "Make which face non-italic: "))) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
664 (if (eq frame t) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
665 (set-face-font face (if (memq 'bold (face-font face t)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
666 '(bold) nil) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
667 t) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
668 (let ((ofont (face-font face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
669 font font1) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
670 (if (null frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
671 (let ((frames (frame-list))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
672 ;; Make this face unitalic in global-face-data. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
673 (make-face-unitalic face t noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
674 ;; Make this face unitalic in each frame. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
675 (while frames |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
676 (make-face-unitalic face (car frames) noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
677 (setq frames (cdr frames)))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
678 (setq face (internal-get-face face frame)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
679 (setq font1 (or (face-font face frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
680 (face-font face t))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
681 (if (listp font1) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
682 (setq font1 nil)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
683 (setq font1 (or font1 |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
684 (face-font 'default frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
685 (cdr (assq 'font (frame-parameters frame))))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
686 (setq font (x-make-font-unitalic font1)) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
687 (if font (internal-try-face-font face font frame))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
688 (or (not (equal ofont (face-font face))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
689 (and (not noerror) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
690 (error "No unitalic version of %S" font1)))))) |
2456 | 691 |
4083
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
692 (defvar list-faces-sample-text |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
693 "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
694 "*Text string to display as the sample text for `list-faces-display'.") |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
695 |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
696 ;; The name list-faces would be more consistent, but let's avoid a conflict |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
697 ;; with Lucid, which uses that name differently. |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
698 (defun list-faces-display () |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
699 "List all faces, using the same sample text in each. |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
700 The sample text is a string that comes from the variable |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
701 `list-faces-sample-text'. |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
702 |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
703 It is possible to give a particular face name different appearances in |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
704 different frames. This command shows the appearance in the |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
705 selected frame." |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
706 (interactive) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
707 (let ((faces (sort (face-list) (function string-lessp))) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
708 (face nil) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
709 (frame (selected-frame)) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
710 disp-frame window) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
711 (with-output-to-temp-buffer "*Faces*" |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
712 (save-excursion |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
713 (set-buffer standard-output) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
714 (setq truncate-lines t) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
715 (while faces |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
716 (setq face (car faces)) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
717 (setq faces (cdr faces)) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
718 (insert (format "%25s " (symbol-name face))) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
719 (let ((beg (point))) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
720 (insert list-faces-sample-text) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
721 (insert "\n") |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
722 (put-text-property beg (1- (point)) 'face face))) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
723 (goto-char (point-min)))) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
724 ;; If the *Faces* buffer appears in a different frame, |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
725 ;; copy all the face definitions from FRAME, |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
726 ;; so that the display will reflect the frame that was selected. |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
727 (setq window (get-buffer-window (get-buffer "*Faces*") t)) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
728 (setq disp-frame (if window (window-frame window) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
729 (car (frame-list)))) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
730 (or (eq frame disp-frame) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
731 (let ((faces (face-list))) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
732 (while faces |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
733 (copy-face (car faces) (car faces) frame disp-frame) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
734 (setq faces (cdr faces))))))) |
465c6787d6dd
(copy-face): New arg NEW-FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
3969
diff
changeset
|
735 |
3910 | 736 ;;; Make the default and modeline faces; the C code knows these as |
737 ;;; faces 0 and 1, respectively, so they must be the first two faces | |
738 ;;; made. | |
2764
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
739 (defun face-initialize () |
2456 | 740 (make-face 'default) |
2826
9c22af6d7885
(face-initialize): Do make the modeline face.
Richard M. Stallman <rms@gnu.org>
parents:
2807
diff
changeset
|
741 (make-face 'modeline) |
2456 | 742 (make-face 'highlight) |
743 ;; | |
744 ;; These aren't really special in any way, but they're nice to have around. | |
745 ;; The X-specific code is clever at them. | |
746 ;; | |
747 (make-face 'bold) | |
748 (make-face 'italic) | |
749 (make-face 'bold-italic) | |
2807
9e8635dafd40
Rename `primary-selection' to `region'.
Richard M. Stallman <rms@gnu.org>
parents:
2800
diff
changeset
|
750 (make-face 'region) |
2764
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
751 (make-face 'secondary-selection) |
3911
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
752 (make-face 'underline) |
2764
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
753 |
2807
9e8635dafd40
Rename `primary-selection' to `region'.
Richard M. Stallman <rms@gnu.org>
parents:
2800
diff
changeset
|
754 (setq region-face (face-id 'region)) |
2800
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
755 |
2764
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
756 ;; Set up the faces of all existing X Window frames. |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
757 (let ((frames (frame-list))) |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
758 (while frames |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
759 (if (eq (framep (car frames)) 'x) |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
760 (x-initialize-frame-faces (car frames))) |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
761 (setq frames (cdr frames))))) |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
762 |
2456 | 763 |
764 ;;; This really belongs in setting a frame's own font. | |
765 ;;; ;; | |
766 ;;; ;; No font specified in the resource database; try to cope. | |
767 ;;; ;; | |
768 ;;; (internal-try-face-font default "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*" | |
769 ;;; frame) | |
770 ;;; (internal-try-face-font default "-*-courier-*-r-*-*-*-120-*-*-*-*-iso8859-*" | |
771 ;;; frame) | |
772 ;;; (internal-try-face-font default "-*-*-medium-r-*-*-*-120-*-*-m-*-iso8859-*" frame) | |
773 ;;; (internal-try-face-font default "-*-*-medium-r-*-*-*-120-*-*-c-*-iso8859-*" frame) | |
774 ;;; (internal-try-face-font default "-*-*-*-r-*-*-*-120-*-*-m-*-iso8859-*" frame) | |
775 ;;; (internal-try-face-font default "-*-*-*-r-*-*-*-120-*-*-c-*-iso8859-*" frame) | |
776 ;;; (internal-try-face-font default "-*-*-*-r-*-*-*-120-*-*-*-*-iso8859-*" frame) | |
777 | |
778 | |
779 ;;; This is called from make-screen-initial-faces to make sure that the | |
780 ;;; "default" and "modeline" faces for this screen have enough attributes | |
781 ;;; specified for emacs to be able to display anything on it. This had | |
782 ;;; better not signal an error. | |
783 ;;; | |
784 (defun x-initialize-frame-faces (frame) | |
785 (or (face-differs-from-default-p 'bold frame) | |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
786 (make-face-bold 'bold frame t) |
2456 | 787 ;; if default font is bold, then make the `bold' face be unbold. |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
788 (make-face-unbold 'bold frame t) |
2456 | 789 ;; otherwise the luser specified one of the bogus font names |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
790 (internal-x-complain-about-font 'bold frame) |
2456 | 791 ) |
792 | |
793 (or (face-differs-from-default-p 'italic frame) | |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
794 (make-face-italic 'italic frame t) |
2456 | 795 (progn |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
796 (make-face-bold 'italic frame t) |
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
797 (internal-x-complain-about-font 'italic frame)) |
2456 | 798 ) |
799 | |
800 (or (face-differs-from-default-p 'bold-italic frame) | |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
801 (make-face-bold-italic 'bold-italic frame t) |
2456 | 802 ;; if we couldn't get a bold-italic version, try just bold. |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
803 (make-face-bold 'bold-italic frame t) |
2456 | 804 ;; if we couldn't get bold or bold-italic, then that's probably because |
805 ;; the default font is bold, so make the `bold-italic' face be unbold. | |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
806 (and (make-face-unbold 'bold-italic frame t) |
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
807 (make-face-italic 'bold-italic frame t)) |
2456 | 808 ;; if that didn't work, try italic (can this ever happen? what the hell.) |
809 (progn | |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
810 (make-face-italic 'bold-italic frame t) |
2456 | 811 ;; then bitch and moan. |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
812 (internal-x-complain-about-font 'bold-italic frame)) |
2456 | 813 ) |
814 | |
815 (or (face-differs-from-default-p 'highlight frame) | |
3911
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
816 (if (or (not (x-display-color-p)) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
817 (= (x-display-planes) 1)) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
818 (invert-face 'highlight frame) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
819 (condition-case () |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
820 (condition-case () |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
821 (set-face-background 'highlight "darkseagreen2" frame) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
822 (error (set-face-background 'highlight "green" frame))) |
2800
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
823 ;;; (set-face-background-pixmap 'highlight "gray1" frame) |
3911
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
824 (error (invert-face 'highlight frame))))) |
2456 | 825 |
2807
9e8635dafd40
Rename `primary-selection' to `region'.
Richard M. Stallman <rms@gnu.org>
parents:
2800
diff
changeset
|
826 (or (face-differs-from-default-p 'region frame) |
3911
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
827 (if (= (x-display-planes) 1) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
828 (invert-face 'region frame) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
829 (condition-case () |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
830 (set-face-background 'region "gray" frame) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
831 (error (invert-face 'region frame))))) |
2456 | 832 |
2826
9c22af6d7885
(face-initialize): Do make the modeline face.
Richard M. Stallman <rms@gnu.org>
parents:
2807
diff
changeset
|
833 (or (face-differs-from-default-p 'modeline frame) |
9c22af6d7885
(face-initialize): Do make the modeline face.
Richard M. Stallman <rms@gnu.org>
parents:
2807
diff
changeset
|
834 (invert-face 'modeline frame)) |
9c22af6d7885
(face-initialize): Do make the modeline face.
Richard M. Stallman <rms@gnu.org>
parents:
2807
diff
changeset
|
835 |
3911
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
836 (or (face-differs-from-default-p 'underline frame) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
837 (set-face-underline-p 'underline t frame)) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
838 |
2456 | 839 (or (face-differs-from-default-p 'secondary-selection frame) |
3911
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
840 (if (or (not (x-display-color-p)) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
841 (= (x-display-planes) 1)) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
842 (invert-face 'secondary-selection frame) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
843 (condition-case () |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
844 (condition-case () |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
845 ;; some older X servers don't have this one. |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
846 (set-face-background 'secondary-selection "paleturquoise" |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
847 frame) |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
848 (error |
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
849 (set-face-background 'secondary-selection "green" frame))) |
2800
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
850 ;;; (set-face-background-pixmap 'secondary-selection "gray1" frame) |
3911
06dbadd0e4a7
(face-initialize): Create `underline' face.
Richard M. Stallman <rms@gnu.org>
parents:
3910
diff
changeset
|
851 (error (invert-face 'secondary-selection frame))))) |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
852 ) |
2456 | 853 |
2714
bfe999b19082
* faces.el (read-face-name): Call face-list, not list-faces.
Jim Blandy <jimb@redhat.com>
parents:
2456
diff
changeset
|
854 (defun internal-x-complain-about-font (face frame) |
2800
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
855 ;;; It's annoying to bother the user about this, |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
856 ;;; since it happens under normal circumstances. |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
857 ;;; (message "No %s version of %S" |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
858 ;;; face |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
859 ;;; (or (face-font face frame) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
860 ;;; (face-font face t) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
861 ;;; (face-font 'default frame) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
862 ;;; (cdr (assq 'font (frame-parameters frame))))) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
863 ;;; (sit-for 1) |
a7b260d27c2c
(face-initialize): Don't create the `modeline' face.
Richard M. Stallman <rms@gnu.org>
parents:
2764
diff
changeset
|
864 ) |
2456 | 865 |
866 ;; Like x-create-frame but also set up the faces. | |
867 | |
868 (defun x-create-frame-with-faces (&optional parameters) | |
2764
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
869 (if (null global-face-data) |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
870 (x-create-frame parameters) |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
871 (let* ((frame (x-create-frame parameters)) |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
872 (faces (copy-alist global-face-data)) |
2826
9c22af6d7885
(face-initialize): Do make the modeline face.
Richard M. Stallman <rms@gnu.org>
parents:
2807
diff
changeset
|
873 (rest faces)) |
2764
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
874 (set-frame-face-alist frame faces) |
2456 | 875 |
3049
314cb8d34dcd
(x-create-frame-with-faces): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
3001
diff
changeset
|
876 (if (cdr (or (assq 'reverse parameters) |
3182
d38749acdf27
(x-create-frame-with-faces): Handle reverseVideo resource.
Richard M. Stallman <rms@gnu.org>
parents:
3130
diff
changeset
|
877 (assq 'reverse default-frame-alist) |
d38749acdf27
(x-create-frame-with-faces): Handle reverseVideo resource.
Richard M. Stallman <rms@gnu.org>
parents:
3130
diff
changeset
|
878 (cons nil |
3555
3b95ad470ccc
(x-create-frame-with-faces): Reversevideo -> ReverseVideo.
Richard M. Stallman <rms@gnu.org>
parents:
3353
diff
changeset
|
879 (x-get-resource "reverseVideo" "ReverseVideo")))) |
3049
314cb8d34dcd
(x-create-frame-with-faces): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
3001
diff
changeset
|
880 (let ((params (frame-parameters frame))) |
314cb8d34dcd
(x-create-frame-with-faces): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
3001
diff
changeset
|
881 (modify-frame-parameters |
314cb8d34dcd
(x-create-frame-with-faces): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
3001
diff
changeset
|
882 frame |
314cb8d34dcd
(x-create-frame-with-faces): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
3001
diff
changeset
|
883 (list (cons 'foreground-color (cdr (assq 'background-color params))) |
314cb8d34dcd
(x-create-frame-with-faces): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
3001
diff
changeset
|
884 (cons 'background-color (cdr (assq 'foreground-color params))) |
314cb8d34dcd
(x-create-frame-with-faces): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
3001
diff
changeset
|
885 (cons 'mouse-color (cdr (assq 'background-color params))) |
314cb8d34dcd
(x-create-frame-with-faces): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
3001
diff
changeset
|
886 (cons 'cursor-color (cdr (assq 'background-color params))) |
314cb8d34dcd
(x-create-frame-with-faces): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
3001
diff
changeset
|
887 (cons 'border-color (cdr (assq 'background-color params))))))) |
314cb8d34dcd
(x-create-frame-with-faces): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
3001
diff
changeset
|
888 |
2764
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
889 ;; Copy the vectors that represent the faces. |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
890 ;; Also fill them in from X resources. |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
891 (while rest |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
892 (setcdr (car rest) (copy-sequence (cdr (car rest)))) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
893 (if (listp (face-font (cdr (car rest)))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
894 (let ((bold (memq 'bold (face-font (cdr (car rest))))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
895 (italic (memq 'italic (face-font (cdr (car rest)))))) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
896 (if (and bold italic) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
897 (make-face-bold-italic (car (car rest)) frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
898 (if bold |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
899 (make-face-bold (car (car rest)) frame) |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
900 (if italic |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
901 (make-face-italic (car (car rest)) frame)))))) |
2764
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
902 (make-face-x-resource-internal (cdr (car rest)) frame t) |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
903 (setq rest (cdr rest))) |
2456 | 904 |
2764
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
905 (x-initialize-frame-faces frame) |
2456 | 906 |
2764
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
907 frame))) |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
908 |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
909 ;; If we are already using x-window frames, initialize faces for them. |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
910 (if (eq (framep (selected-frame)) 'x) |
17c322204ce3
(face-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2744
diff
changeset
|
911 (face-initialize)) |
2456 | 912 |
2715
9caee9338229
* faces.el: Call internal-set-face-1, not internat-set-face-1.
Jim Blandy <jimb@redhat.com>
parents:
2714
diff
changeset
|
913 (provide 'faces) |
9caee9338229
* faces.el: Call internal-set-face-1, not internat-set-face-1.
Jim Blandy <jimb@redhat.com>
parents:
2714
diff
changeset
|
914 |
2456 | 915 ;;; faces.el ends here |