428
|
1 ;;; faces.el --- Lisp interface to the C "face" structure
|
|
2
|
|
3 ;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc.
|
|
4 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
|
|
5 ;; Copyright (C) 1995, 1996 Ben Wing
|
|
6
|
|
7 ;; Author: Ben Wing <ben@xemacs.org>
|
|
8 ;; Keywords: faces, internal, dumped
|
|
9
|
|
10 ;; This file is part of XEmacs.
|
|
11
|
|
12 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
13 ;; under the terms of the GNU General Public License as published by
|
|
14 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
15 ;; any later version.
|
|
16
|
|
17 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20 ;; General Public License for more details.
|
|
21
|
|
22 ;; You should have received a copy of the GNU General Public License
|
|
23 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
25 ;; Boston, MA 02111-1307, USA.
|
|
26
|
|
27 ;;; Synched up with: Not synched with FSF. Almost completely divergent.
|
|
28
|
|
29 ;;; Commentary:
|
|
30
|
|
31 ;; This file is dumped with XEmacs.
|
|
32
|
|
33 ;; face implementation #1 (used Lisp vectors and parallel C vectors;
|
|
34 ;; FSFmacs still uses this) authored by Jamie Zawinski <jwz@jwz.org>
|
|
35 ;; pre Lucid-Emacs 19.0.
|
|
36
|
|
37 ;; face implementation #2 (used one face object per frame per face)
|
|
38 ;; authored by Jamie Zawinski for 19.9.
|
|
39
|
|
40 ;; face implementation #3 (use one face object per face) originally
|
|
41 ;; authored for 19.12 by Chuck Thompson <cthomp@cs.uiuc.edu>,
|
|
42 ;; rewritten by Ben Wing with the advent of specifiers.
|
|
43
|
|
44
|
|
45 ;;; Some stuff in FSF's faces.el is in our x-faces.el.
|
|
46
|
|
47 ;;; Code:
|
|
48
|
771
|
49 ;; To elude the warnings for font functions. (Normally autoloaded when
|
|
50 ;; font-create-object is called)
|
|
51 (eval-when-compile
|
|
52 (require 'font))
|
|
53
|
428
|
54 (defgroup faces nil
|
|
55 "Support for multiple text attributes (fonts, colors, ...)
|
|
56 Such a collection of attributes is called a \"face\"."
|
|
57 :group 'emacs)
|
|
58
|
|
59
|
|
60 (defun read-face-name (prompt)
|
|
61 (let (face)
|
|
62 (while (= (length face) 0) ; nil or ""
|
|
63 (setq face (completing-read prompt
|
|
64 (mapcar (lambda (x) (list (symbol-name x)))
|
|
65 (face-list))
|
|
66 nil t)))
|
|
67 (intern face)))
|
|
68
|
|
69 (defun face-interactive (what &optional bool)
|
|
70 (let* ((fn (intern (concat "face-" what "-instance")))
|
|
71 (face (read-face-name (format "Set %s of face: " what)))
|
|
72 (default (if (fboundp fn)
|
|
73 ;; #### we should distinguish here between
|
|
74 ;; explicitly setting the value to be the
|
|
75 ;; same as the default face's value, and
|
|
76 ;; not setting a value at all.
|
|
77 (funcall fn face)))
|
|
78 (value (if bool
|
|
79 (y-or-n-p (format "Should face %s be %s? "
|
|
80 (symbol-name face) bool))
|
|
81 (read-string (format "Set %s of face %s to: "
|
|
82 what (symbol-name face))
|
|
83 (cond ((font-instance-p default)
|
|
84 (font-instance-name default))
|
|
85 ((color-instance-p default)
|
|
86 (color-instance-name default))
|
|
87 ((image-instance-p default)
|
|
88 (image-instance-file-name default))
|
|
89 (t default))))))
|
|
90 (list face (if (equal value "") nil value))))
|
|
91
|
|
92 (defconst built-in-face-specifiers
|
|
93 (built-in-face-specifiers)
|
|
94 "A list of the built-in face properties that are specifiers.")
|
|
95
|
|
96 (defun face-property (face property &optional locale tag-set exact-p)
|
|
97 "Return FACE's value of the given PROPERTY.
|
|
98
|
|
99 If LOCALE is omitted, the FACE's actual value for PROPERTY will be
|
|
100 returned. For built-in properties, this will be a specifier object
|
|
101 of a type appropriate to the property (e.g. a font or color
|
|
102 specifier). For other properties, this could be anything.
|
|
103
|
|
104 If LOCALE is supplied, then instead of returning the actual value,
|
|
105 the specification(s) for the given locale or locale type will
|
|
106 be returned. This will only work if the actual value of
|
|
107 PROPERTY is a specifier (this will always be the case for built-in
|
|
108 properties, but not or not may apply to user-defined properties).
|
|
109 If the actual value of PROPERTY is not a specifier, this value
|
|
110 will simply be returned regardless of LOCALE.
|
|
111
|
|
112 The return value will be a list of instantiators (e.g. strings
|
|
113 specifying a font or color name), or a list of specifications, each
|
|
114 of which is a cons of a locale and a list of instantiators.
|
|
115 Specifically, if LOCALE is a particular locale (a buffer, window,
|
|
116 frame, device, or 'global), a list of instantiators for that locale
|
|
117 will be returned. Otherwise, if LOCALE is a locale type (one of
|
|
118 the symbols 'buffer, 'window, 'frame, or 'device), the specifications
|
|
119 for all locales of that type will be returned. Finally, if LOCALE is
|
|
120 'all, the specifications for all locales of all types will be returned.
|
|
121
|
|
122 The specifications in a specifier determine what the value of
|
|
123 PROPERTY will be in a particular \"domain\" or set of circumstances,
|
|
124 which is typically a particular Emacs window along with the buffer
|
442
|
125 it contains and the frame and device it lies within. The value is
|
|
126 derived from the instantiator associated with the most specific
|
428
|
127 locale (in the order buffer, window, frame, device, and 'global)
|
|
128 that matches the domain in question. In other words, given a domain
|
442
|
129 (i.e. an Emacs window, usually), the specifier for PROPERTY will
|
|
130 first be searched for a specification whose locale is the buffer
|
|
131 contained within that window; then for a specification whose locale
|
|
132 is the window itself; then for a specification whose locale is the
|
|
133 frame that the window is contained within; etc. The first
|
|
134 instantiator that is valid for the domain (usually this means that
|
|
135 the instantiator is recognized by the device [i.e. MS Windows, the X
|
|
136 server or TTY device] that the domain is on. The function
|
|
137 `face-property-instance' actually does all this, and is used to
|
|
138 determine how to display the face.
|
428
|
139
|
|
140 See `set-face-property' for the built-in property-names."
|
|
141
|
|
142 (setq face (get-face face))
|
|
143 (let ((value (get face property)))
|
|
144 (if (and locale
|
|
145 (or (memq property built-in-face-specifiers)
|
|
146 (specifierp value)))
|
|
147 (setq value (specifier-specs value locale tag-set exact-p)))
|
|
148 value))
|
|
149
|
|
150 (defun convert-face-property-into-specifier (face property)
|
|
151 "Convert PROPERTY on FACE into a specifier, if it's not already."
|
|
152 (setq face (get-face face))
|
|
153 (let ((specifier (get face property)))
|
|
154 ;; if a user-property does not have a specifier but a
|
|
155 ;; locale was specified, put a specifier there.
|
|
156 ;; If there was already a value there, convert it to a
|
|
157 ;; specifier with the value as its 'global instantiator.
|
|
158 (unless (specifierp specifier)
|
|
159 (let ((new-specifier (make-specifier 'generic)))
|
|
160 (if (or (not (null specifier))
|
|
161 ;; make sure the nil returned from `get' wasn't
|
|
162 ;; actually the value of the property
|
|
163 (null (get face property t)))
|
|
164 (add-spec-to-specifier new-specifier specifier))
|
|
165 (setq specifier new-specifier)
|
|
166 (put face property specifier)))))
|
|
167
|
|
168 (defun face-property-instance (face property
|
|
169 &optional domain default no-fallback)
|
|
170 "Return the instance of FACE's PROPERTY in the specified DOMAIN.
|
|
171
|
|
172 Under most circumstances, DOMAIN will be a particular window,
|
|
173 and the returned instance describes how the specified property
|
|
174 actually is displayed for that window and the particular buffer
|
|
175 in it. Note that this may not be the same as how the property
|
|
176 appears when the buffer is displayed in a different window or
|
|
177 frame, or how the property appears in the same window if you
|
|
178 switch to another buffer in that window; and in those cases,
|
|
179 the returned instance would be different.
|
|
180
|
|
181 The returned instance will typically be a color-instance,
|
|
182 font-instance, or pixmap-instance object, and you can query
|
|
183 it using the appropriate object-specific functions. For example,
|
|
184 you could use `color-instance-rgb-components' to find out the
|
|
185 RGB (red, green, and blue) components of how the 'background
|
|
186 property of the 'highlight face is displayed in a particular
|
|
187 window. The results might be different from the results
|
|
188 you would get for another window (perhaps the user
|
|
189 specified a different color for the frame that window is on;
|
|
190 or perhaps the same color was specified but the window is
|
|
191 on a different X server, and that X server has different RGB
|
|
192 values for the color from this one).
|
|
193
|
|
194 DOMAIN defaults to the selected window if omitted.
|
|
195
|
|
196 DOMAIN can be a frame or device, instead of a window. The value
|
|
197 returned for a such a domain is used in special circumstances
|
|
198 when a more specific domain does not apply; for example, a frame
|
|
199 value might be used for coloring a toolbar, which is conceptually
|
|
200 attached to a frame rather than a particular window. The value
|
|
201 is also useful in determining what the value would be for a
|
|
202 particular window within the frame or device, if it is not
|
|
203 overridden by a more specific specification.
|
|
204
|
|
205 If PROPERTY does not name a built-in property, its value will
|
|
206 simply be returned unless it is a specifier object, in which case
|
|
207 it will be instanced using `specifier-instance'.
|
|
208
|
|
209 Optional arguments DEFAULT and NO-FALLBACK are the same as in
|
|
210 `specifier-instance'."
|
|
211
|
|
212 (setq face (get-face face))
|
|
213 (let ((value (get face property)))
|
|
214 (if (specifierp value)
|
|
215 (setq value (specifier-instance value domain default no-fallback)))
|
|
216 value))
|
|
217
|
|
218 (defun face-property-matching-instance (face property matchspec
|
|
219 &optional domain default
|
|
220 no-fallback)
|
|
221 "Return the instance of FACE's PROPERTY matching MATCHSPEC in DOMAIN.
|
|
222 Currently the only useful value for MATCHSPEC is a charset, when used
|
|
223 in conjunction with the face's font; this allows you to retrieve a
|
|
224 font that can be used to display a particular charset, rather than just
|
|
225 any font.
|
|
226
|
|
227 Other than MATCHSPEC, this function is identical to `face-property-instance'.
|
|
228 See also `specifier-matching-instance' for a fuller description of the
|
|
229 matching process."
|
|
230
|
|
231 (setq face (get-face face))
|
|
232 (let ((value (get face property)))
|
|
233 (if (specifierp value)
|
|
234 (setq value (specifier-matching-instance value matchspec domain
|
|
235 default no-fallback)))
|
|
236 value))
|
|
237
|
|
238 (defun set-face-property (face property value &optional locale tag-set
|
|
239 how-to-add)
|
|
240 "Change a property of FACE.
|
|
241
|
|
242 NOTE: If you want to remove a property from a face, use `remove-face-property'
|
|
243 rather than attempting to set a value of nil for the property.
|
|
244
|
|
245 For built-in properties, the actual value of the property is a
|
|
246 specifier and you cannot change this; but you can change the
|
|
247 specifications within the specifier, and that is what this function
|
|
248 will do. For user-defined properties, you can use this function
|
|
249 to either change the actual value of the property or, if this value
|
|
250 is a specifier, change the specifications within it.
|
|
251
|
|
252 If PROPERTY is a built-in property, the specifications to be added to
|
|
253 this property can be supplied in many different ways:
|
|
254
|
|
255 -- If VALUE is a simple instantiator (e.g. a string naming a font or
|
|
256 color) or a list of instantiators, then the instantiator(s) will
|
|
257 be added as a specification of the property for the given LOCALE
|
|
258 (which defaults to 'global if omitted).
|
|
259 -- If VALUE is a list of specifications (each of which is a cons of
|
|
260 a locale and a list of instantiators), then LOCALE must be nil
|
|
261 (it does not make sense to explicitly specify a locale in this
|
|
262 case), and specifications will be added as given.
|
|
263 -- If VALUE is a specifier (as would be returned by `face-property'
|
|
264 if no LOCALE argument is given), then some or all of the
|
|
265 specifications in the specifier will be added to the property.
|
|
266 In this case, the function is really equivalent to
|
|
267 `copy-specifier' and LOCALE has the same semantics (if it is
|
|
268 a particular locale, the specification for the locale will be
|
|
269 copied; if a locale type, specifications for all locales of
|
|
270 that type will be copied; if nil or 'all, then all
|
|
271 specifications will be copied).
|
|
272
|
|
273 HOW-TO-ADD should be either nil or one of the symbols 'prepend,
|
|
274 'append, 'remove-tag-set-prepend, 'remove-tag-set-append, 'remove-locale,
|
|
275 'remove-locale-type, or 'remove-all. See `copy-specifier' and
|
|
276 `add-spec-to-specifier' for a description of what each of
|
|
277 these means. Most of the time, you do not need to worry about
|
|
278 this argument; the default behavior usually is fine.
|
|
279
|
|
280 In general, it is OK to pass an instance object (e.g. as returned
|
|
281 by `face-property-instance') as an instantiator in place of
|
|
282 an actual instantiator. In such a case, the instantiator used
|
|
283 to create that instance object will be used (for example, if
|
|
284 you set a font-instance object as the value of the 'font
|
|
285 property, then the font name used to create that object will
|
|
286 be used instead). If some cases, however, doing this
|
|
287 conversion does not make sense, and this will be noted in
|
|
288 the documentation for particular types of instance objects.
|
|
289
|
|
290 If PROPERTY is not a built-in property, then this function will
|
|
291 simply set its value if LOCALE is nil. However, if LOCALE is
|
|
292 given, then this function will attempt to add VALUE as the
|
|
293 instantiator for the given LOCALE, using `add-spec-to-specifier'.
|
|
294 If the value of the property is not a specifier, it will
|
|
295 automatically be converted into a 'generic specifier.
|
|
296
|
|
297
|
|
298 The following symbols have predefined meanings:
|
|
299
|
|
300 foreground The foreground color of the face.
|
442
|
301 For valid instantiators, see `make-color-specifier'.
|
428
|
302
|
|
303 background The background color of the face.
|
442
|
304 For valid instantiators, see `make-color-specifier'.
|
428
|
305
|
|
306 font The font used to display text covered by this face.
|
442
|
307 For valid instantiators, see `make-font-specifier'.
|
428
|
308
|
|
309 display-table The display table of the face.
|
|
310 This should be a vector of 256 elements.
|
|
311
|
|
312 background-pixmap The pixmap displayed in the background of the face.
|
442
|
313 Only used by faces on X and MS Windows devices.
|
|
314 For valid instantiators, see `make-image-specifier'.
|
428
|
315
|
|
316 underline Underline all text covered by this face.
|
442
|
317 For valid instantiators, see `make-face-boolean-specifier'.
|
428
|
318
|
|
319 strikethru Draw a line through all text covered by this face.
|
442
|
320 For valid instantiators, see `make-face-boolean-specifier'.
|
428
|
321
|
|
322 highlight Highlight all text covered by this face.
|
|
323 Only used by faces on TTY devices.
|
442
|
324 For valid instantiators, see `make-face-boolean-specifier'.
|
428
|
325
|
|
326 dim Dim all text covered by this face.
|
442
|
327 For valid instantiators, see `make-face-boolean-specifier'.
|
428
|
328
|
|
329 blinking Blink all text covered by this face.
|
|
330 Only used by faces on TTY devices.
|
442
|
331 For valid instantiators, see `make-face-boolean-specifier'.
|
428
|
332
|
|
333 reverse Reverse the foreground and background colors.
|
|
334 Only used by faces on TTY devices.
|
442
|
335 For valid instantiators, see `make-face-boolean-specifier'.
|
428
|
336
|
|
337 doc-string Description of what the face's normal use is.
|
|
338 NOTE: This is not a specifier, unlike all
|
|
339 the other built-in properties, and cannot
|
|
340 contain locale-specific values."
|
|
341
|
|
342 (setq face (get-face face))
|
|
343 (if (memq property built-in-face-specifiers)
|
|
344 (set-specifier (get face property) value locale tag-set how-to-add)
|
|
345
|
|
346 ;; This section adds user defined properties.
|
|
347 (if (not locale)
|
|
348 (put face property value)
|
|
349 (convert-face-property-into-specifier face property)
|
|
350 (add-spec-to-specifier (get face property) value locale tag-set
|
|
351 how-to-add)))
|
|
352 value)
|
|
353
|
|
354 (defun remove-face-property (face property &optional locale tag-set exact-p)
|
|
355 "Remove a property from FACE.
|
|
356 For built-in properties, this is analogous to `remove-specifier'.
|
|
357 See `remove-specifier' for the meaning of the LOCALE, TAG-SET, and EXACT-P
|
|
358 arguments."
|
|
359 (or locale (setq locale 'all))
|
|
360 (if (memq property built-in-face-specifiers)
|
|
361 (remove-specifier (face-property face property) locale tag-set exact-p)
|
|
362 (if (eq locale 'all)
|
|
363 (remprop (get-face face) property)
|
|
364 (convert-face-property-into-specifier face property)
|
|
365 (remove-specifier (face-property face property) locale tag-set
|
|
366 exact-p))))
|
|
367
|
|
368 (defun reset-face (face &optional locale tag-set exact-p)
|
|
369 "Clear all existing built-in specifications from FACE.
|
|
370 This makes FACE inherit all its display properties from 'default.
|
|
371 WARNING: Be absolutely sure you want to do this!!! It is a dangerous
|
|
372 operation and is not undoable.
|
|
373
|
|
374 The arguments LOCALE, TAG-SET and EXACT-P are the same as for
|
|
375 `remove-specifier'."
|
|
376 (mapc (lambda (x)
|
|
377 (remove-specifier (face-property face x) locale tag-set exact-p))
|
|
378 built-in-face-specifiers)
|
|
379 nil)
|
|
380
|
|
381 (defun set-face-parent (face parent &optional locale tag-set how-to-add)
|
|
382 "Set the parent of FACE to PARENT, for all properties.
|
|
383 This makes all properties of FACE inherit from PARENT."
|
|
384 (setq parent (get-face parent))
|
|
385 (mapcar (lambda (x)
|
|
386 (set-face-property face x (vector parent) locale tag-set
|
|
387 how-to-add))
|
|
388 (delq 'display-table
|
|
389 (delq 'background-pixmap
|
|
390 (copy-sequence built-in-face-specifiers))))
|
|
391 (set-face-background-pixmap face (vector 'inherit ':face parent)
|
|
392 locale tag-set how-to-add)
|
|
393 nil)
|
|
394
|
|
395 (defun face-doc-string (face)
|
|
396 "Return the documentation string for FACE."
|
|
397 (face-property face 'doc-string))
|
|
398
|
|
399 (defun set-face-doc-string (face doc-string)
|
|
400 "Change the documentation string of FACE to DOC-STRING."
|
|
401 (interactive (face-interactive "doc-string"))
|
|
402 (set-face-property face 'doc-string doc-string))
|
|
403
|
|
404 (defun face-font-name (face &optional domain charset)
|
|
405 "Return the font name of FACE in DOMAIN, or nil if it is unspecified.
|
|
406 DOMAIN is as in `face-font-instance'."
|
|
407 (let ((f (face-font-instance face domain charset)))
|
|
408 (and f (font-instance-name f))))
|
|
409
|
|
410 (defun face-font (face &optional locale tag-set exact-p)
|
|
411 "Return the font of FACE in LOCALE, or nil if it is unspecified.
|
|
412
|
|
413 FACE may be either a face object or a symbol representing a face.
|
|
414
|
|
415 LOCALE may be a locale (the instantiators for that particular locale
|
|
416 will be returned), a locale type (the specifications for all locales
|
|
417 of that type will be returned), 'all (all specifications will be
|
|
418 returned), or nil (the actual specifier object will be returned).
|
|
419
|
|
420 See `face-property' for more information."
|
|
421 (face-property face 'font locale tag-set exact-p))
|
|
422
|
|
423 (defun face-font-instance (face &optional domain charset)
|
|
424 "Return the instance of FACE's font in DOMAIN.
|
|
425
|
|
426 FACE may be either a face object or a symbol representing a face.
|
|
427
|
|
428 Normally DOMAIN will be a window or nil (meaning the selected window),
|
|
429 and an instance object describing how the font appears in that
|
|
430 particular window and buffer will be returned.
|
|
431
|
|
432 See `face-property-instance' for more information."
|
|
433 (if charset
|
|
434 (face-property-matching-instance face 'font charset domain)
|
|
435 (face-property-instance face 'font domain)))
|
|
436
|
|
437 (defun set-face-font (face font &optional locale tag-set how-to-add)
|
|
438 "Change the font of FACE to FONT in LOCALE.
|
|
439
|
|
440 FACE may be either a face object or a symbol representing a face.
|
|
441
|
442
|
442 FONT should be an instantiator (see `make-font-specifier'), a list of
|
428
|
443 instantiators, an alist of specifications (each mapping a
|
|
444 locale to an instantiator list), or a font specifier object.
|
|
445
|
|
446 If FONT is an alist, LOCALE must be omitted. If FONT is a
|
|
447 specifier object, LOCALE can be a locale, a locale type, 'all,
|
|
448 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
|
|
449 specifies the locale under which the specified instantiator(s)
|
|
450 will be added, and defaults to 'global.
|
|
451
|
|
452 See `set-face-property' for more information."
|
|
453 (interactive (face-interactive "font"))
|
|
454 (set-face-property face 'font font locale tag-set how-to-add))
|
|
455
|
|
456 (defun face-foreground (face &optional locale tag-set exact-p)
|
|
457 "Return the foreground of FACE in LOCALE, or nil if it is unspecified.
|
|
458
|
|
459 FACE may be either a face object or a symbol representing a face.
|
|
460
|
|
461 LOCALE may be a locale (the instantiators for that particular locale
|
|
462 will be returned), a locale type (the specifications for all locales
|
|
463 of that type will be returned), 'all (all specifications will be
|
|
464 returned), or nil (the actual specifier object will be returned).
|
|
465
|
|
466 See `face-property' for more information."
|
|
467 (face-property face 'foreground locale tag-set exact-p))
|
|
468
|
|
469 (defun face-foreground-instance (face &optional domain default no-fallback)
|
|
470 "Return the instance of FACE's foreground in DOMAIN.
|
|
471
|
|
472 FACE may be either a face object or a symbol representing a face.
|
|
473
|
|
474 Normally DOMAIN will be a window or nil (meaning the selected window),
|
|
475 and an instance object describing how the foreground appears in that
|
|
476 particular window and buffer will be returned.
|
|
477
|
|
478 See `face-property-instance' for more information."
|
|
479 (face-property-instance face 'foreground domain default no-fallback))
|
|
480
|
|
481 (defun face-foreground-name (face &optional domain default no-fallback)
|
|
482 "Return the name of FACE's foreground color in DOMAIN.
|
|
483
|
|
484 FACE may be either a face object or a symbol representing a face.
|
|
485
|
|
486 Normally DOMAIN will be a window or nil (meaning the selected window),
|
|
487 and an instance object describing how the background appears in that
|
|
488 particular window and buffer will be returned.
|
|
489
|
|
490 See `face-property-instance' for more information."
|
|
491 (color-instance-name (face-foreground-instance
|
|
492 face domain default no-fallback)))
|
|
493
|
|
494 (defun set-face-foreground (face color &optional locale tag-set how-to-add)
|
|
495 "Change the foreground color of FACE to COLOR in LOCALE.
|
|
496
|
|
497 FACE may be either a face object or a symbol representing a face.
|
|
498
|
442
|
499 COLOR should be an instantiator (see `make-color-specifier'), a list of
|
428
|
500 instantiators, an alist of specifications (each mapping a locale to
|
|
501 an instantiator list), or a color specifier object.
|
|
502
|
|
503 If COLOR is an alist, LOCALE must be omitted. If COLOR is a
|
|
504 specifier object, LOCALE can be a locale, a locale type, 'all,
|
|
505 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
|
|
506 specifies the locale under which the specified instantiator(s)
|
|
507 will be added, and defaults to 'global.
|
|
508
|
|
509 See `set-face-property' for more information."
|
|
510 (interactive (face-interactive "foreground"))
|
|
511 (set-face-property face 'foreground color locale tag-set how-to-add))
|
|
512
|
|
513 (defun face-background (face &optional locale tag-set exact-p)
|
|
514 "Return the background color of FACE in LOCALE, or nil if it is unspecified.
|
|
515
|
|
516 FACE may be either a face object or a symbol representing a face.
|
|
517
|
|
518 LOCALE may be a locale (the instantiators for that particular locale
|
|
519 will be returned), a locale type (the specifications for all locales
|
|
520 of that type will be returned), 'all (all specifications will be
|
|
521 returned), or nil (the actual specifier object will be returned).
|
|
522
|
|
523 See `face-property' for more information."
|
|
524 (face-property face 'background locale tag-set exact-p))
|
|
525
|
|
526 (defun face-background-instance (face &optional domain default no-fallback)
|
|
527 "Return the instance of FACE's background in DOMAIN.
|
|
528
|
|
529 FACE may be either a face object or a symbol representing a face.
|
|
530
|
|
531 Normally DOMAIN will be a window or nil (meaning the selected window),
|
|
532 and an instance object describing how the background appears in that
|
|
533 particular window and buffer will be returned.
|
|
534
|
|
535 See `face-property-instance' for more information."
|
|
536 (face-property-instance face 'background domain default no-fallback))
|
|
537
|
|
538 (defun face-background-name (face &optional domain default no-fallback)
|
|
539 "Return the name of FACE's background color in DOMAIN.
|
|
540
|
|
541 FACE may be either a face object or a symbol representing a face.
|
|
542
|
|
543 Normally DOMAIN will be a window or nil (meaning the selected window),
|
|
544 and an instance object describing how the background appears in that
|
|
545 particular window and buffer will be returned.
|
|
546
|
|
547 See `face-property-instance' for more information."
|
|
548 (color-instance-name (face-background-instance
|
|
549 face domain default no-fallback)))
|
|
550
|
|
551 (defun set-face-background (face color &optional locale tag-set how-to-add)
|
|
552 "Change the background color of FACE to COLOR in LOCALE.
|
|
553
|
|
554 FACE may be either a face object or a symbol representing a face.
|
|
555
|
442
|
556 COLOR should be an instantiator (see `make-color-specifier'), a list of
|
428
|
557 instantiators, an alist of specifications (each mapping a locale to
|
|
558 an instantiator list), or a color specifier object.
|
|
559
|
|
560 If COLOR is an alist, LOCALE must be omitted. If COLOR is a
|
|
561 specifier object, LOCALE can be a locale, a locale type, 'all,
|
|
562 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
|
|
563 specifies the locale under which the specified instantiator(s)
|
|
564 will be added, and defaults to 'global.
|
|
565
|
|
566 See `set-face-property' for more information."
|
|
567 (interactive (face-interactive "background"))
|
|
568 (set-face-property face 'background color locale tag-set how-to-add))
|
|
569
|
|
570 (defun face-background-pixmap (face &optional locale tag-set exact-p)
|
|
571 "Return the background pixmap of FACE in LOCALE, or nil if it is unspecified.
|
|
572 This property is only used on window system devices.
|
|
573
|
|
574 FACE may be either a face object or a symbol representing a face.
|
|
575
|
|
576 LOCALE may be a locale (the instantiators for that particular locale
|
|
577 will be returned), a locale type (the specifications for all locales
|
|
578 of that type will be returned), 'all (all specifications will be
|
|
579 returned), or nil (the actual specifier object will be returned).
|
|
580
|
|
581 See `face-property' for more information."
|
|
582 (face-property face 'background-pixmap locale tag-set exact-p))
|
|
583
|
|
584 (defun face-background-pixmap-instance (face &optional domain default
|
|
585 no-fallback)
|
|
586 "Return the instance of FACE's background pixmap in DOMAIN.
|
|
587
|
|
588 FACE may be either a face object or a symbol representing a face.
|
|
589
|
|
590 Normally DOMAIN will be a window or nil (meaning the selected window),
|
|
591 and an instance object describing how the background appears in that
|
|
592 particular window and buffer will be returned.
|
|
593
|
|
594 See `face-property-instance' for more information."
|
|
595 (face-property-instance face 'background-pixmap domain default no-fallback))
|
|
596
|
|
597 (defun set-face-background-pixmap (face pixmap &optional locale tag-set
|
|
598 how-to-add)
|
|
599 "Change the background pixmap of FACE to PIXMAP in LOCALE.
|
|
600 This property is only used on window system devices.
|
|
601
|
|
602 FACE may be either a face object or a symbol representing a face.
|
|
603
|
442
|
604 PIXMAP should be an instantiator (see `make-image-specifier'), a list
|
428
|
605 of instantiators, an alist of specifications (each mapping a locale
|
|
606 to an instantiator list), or an image specifier object.
|
|
607
|
|
608 If PIXMAP is an alist, LOCALE must be omitted. If PIXMAP is a
|
|
609 specifier object, LOCALE can be a locale, a locale type, 'all,
|
|
610 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
|
|
611 specifies the locale under which the specified instantiator(s)
|
|
612 will be added, and defaults to 'global.
|
|
613
|
|
614 See `set-face-property' for more information."
|
|
615 (interactive (face-interactive "background-pixmap"))
|
|
616 (set-face-property face 'background-pixmap pixmap locale tag-set how-to-add))
|
|
617
|
|
618 (defun face-display-table (face &optional locale tag-set exact-p)
|
|
619 "Return the display table of FACE in LOCALE.
|
|
620
|
|
621 A vector (as returned by `make-display-table') will be returned.
|
|
622
|
|
623 LOCALE may be a locale (the instantiators for that particular locale
|
|
624 will be returned), a locale type (the specifications for all locales
|
|
625 of that type will be returned), 'all (all specifications will be
|
|
626 returned), or nil (the actual specifier object will be returned).
|
|
627
|
|
628 See `face-property' for more information."
|
|
629 (face-property face 'display-table locale tag-set exact-p))
|
|
630
|
|
631 (defun face-display-table-instance (face &optional domain default no-fallback)
|
|
632 "Return the instance of FACE's display table in DOMAIN.
|
|
633 A vector (as returned by `make-display-table') will be returned.
|
|
634
|
|
635 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
636 (face-property-instance face 'display-table domain default no-fallback))
|
|
637
|
|
638 (defun set-face-display-table (face display-table &optional locale tag-set
|
|
639 how-to-add)
|
|
640 "Change the display table of FACE to DISPLAY-TABLE in LOCALE.
|
|
641 DISPLAY-TABLE should be a vector as returned by `make-display-table'.
|
|
642
|
|
643 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
|
|
644 HOW-TO-ADD arguments."
|
|
645 (interactive (face-interactive "display-table"))
|
|
646 (set-face-property face 'display-table display-table locale tag-set
|
|
647 how-to-add))
|
|
648
|
|
649 ;; The following accessors and mutators are, IMHO, good
|
|
650 ;; implementation. Cf. with `make-face-bold'.
|
|
651
|
|
652 (defun face-underline-p (face &optional domain default no-fallback)
|
|
653 "Return t if FACE is underlined in DOMAIN.
|
|
654 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
655 (face-property-instance face 'underline domain default no-fallback))
|
|
656
|
|
657 (defun set-face-underline-p (face underline-p &optional locale tag-set
|
|
658 how-to-add)
|
|
659 "Change the underline property of FACE to UNDERLINE-P.
|
|
660 UNDERLINE-P is normally a face-boolean instantiator; see
|
442
|
661 `make-face-boolean-specifier'.
|
428
|
662 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
|
|
663 HOW-TO-ADD arguments."
|
|
664 (interactive (face-interactive "underline-p" "underlined"))
|
|
665 (set-face-property face 'underline underline-p locale tag-set how-to-add))
|
|
666
|
|
667 (defun face-strikethru-p (face &optional domain default no-fallback)
|
|
668 "Return t if FACE is strikethru-d (i.e. struck through) in DOMAIN.
|
|
669 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
670 (face-property-instance face 'strikethru domain default no-fallback))
|
|
671
|
|
672 (defun set-face-strikethru-p (face strikethru-p &optional locale tag-set
|
|
673 how-to-add)
|
|
674 "Change whether FACE is strikethru-d (i.e. struck through) in LOCALE.
|
|
675 STRIKETHRU-P is normally a face-boolean instantiator; see
|
442
|
676 `make-face-boolean-specifier'.
|
428
|
677 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
|
|
678 HOW-TO-ADD arguments."
|
|
679 (interactive (face-interactive "strikethru-p" "strikethru-d"))
|
|
680 (set-face-property face 'strikethru strikethru-p locale tag-set how-to-add))
|
|
681
|
|
682 (defun face-highlight-p (face &optional domain default no-fallback)
|
|
683 "Return t if FACE is highlighted in DOMAIN (TTY domains only).
|
|
684 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
685 (face-property-instance face 'highlight domain default no-fallback))
|
|
686
|
|
687 (defun set-face-highlight-p (face highlight-p &optional locale tag-set
|
|
688 how-to-add)
|
|
689 "Change whether FACE is highlighted in LOCALE (TTY locales only).
|
|
690 HIGHLIGHT-P is normally a face-boolean instantiator; see
|
442
|
691 `make-face-boolean-specifier'.
|
428
|
692 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
|
|
693 HOW-TO-ADD arguments."
|
|
694 (interactive (face-interactive "highlight-p" "highlighted"))
|
|
695 (set-face-property face 'highlight highlight-p locale tag-set how-to-add))
|
|
696
|
|
697 (defun face-dim-p (face &optional domain default no-fallback)
|
|
698 "Return t if FACE is dimmed in DOMAIN.
|
|
699 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
700 (face-property-instance face 'dim domain default no-fallback))
|
|
701
|
|
702 (defun set-face-dim-p (face dim-p &optional locale tag-set how-to-add)
|
|
703 "Change whether FACE is dimmed in LOCALE.
|
|
704 DIM-P is normally a face-boolean instantiator; see
|
442
|
705 `make-face-boolean-specifier'.
|
428
|
706 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
|
|
707 HOW-TO-ADD arguments."
|
|
708 (interactive (face-interactive "dim-p" "dimmed"))
|
|
709 (set-face-property face 'dim dim-p locale tag-set how-to-add))
|
|
710
|
|
711 (defun face-blinking-p (face &optional domain default no-fallback)
|
|
712 "Return t if FACE is blinking in DOMAIN (TTY domains only).
|
|
713 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
714 (face-property-instance face 'blinking domain default no-fallback))
|
|
715
|
|
716 (defun set-face-blinking-p (face blinking-p &optional locale tag-set
|
|
717 how-to-add)
|
|
718 "Change whether FACE is blinking in LOCALE (TTY locales only).
|
|
719 BLINKING-P is normally a face-boolean instantiator; see
|
442
|
720 `make-face-boolean-specifier'.
|
428
|
721 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
|
|
722 HOW-TO-ADD arguments."
|
|
723 (interactive (face-interactive "blinking-p" "blinking"))
|
|
724 (set-face-property face 'blinking blinking-p locale tag-set how-to-add))
|
|
725
|
|
726 (defun face-reverse-p (face &optional domain default no-fallback)
|
|
727 "Return t if FACE is reversed in DOMAIN (TTY domains only).
|
|
728 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
729 (face-property-instance face 'reverse domain default no-fallback))
|
|
730
|
|
731 (defun set-face-reverse-p (face reverse-p &optional locale tag-set how-to-add)
|
|
732 "Change whether FACE is reversed in LOCALE (TTY locales only).
|
|
733 REVERSE-P is normally a face-boolean instantiator; see
|
442
|
734 `make-face-boolean-specifier'.
|
428
|
735 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
|
|
736 HOW-TO-ADD arguments."
|
|
737 (interactive (face-interactive "reverse-p" "reversed"))
|
|
738 (set-face-property face 'reverse reverse-p locale tag-set how-to-add))
|
|
739
|
|
740
|
|
741 (defun face-property-equal (face1 face2 prop domain)
|
|
742 (equal (face-property-instance face1 prop domain)
|
|
743 (face-property-instance face2 prop domain)))
|
|
744
|
|
745 (defun face-equal-loop (props face1 face2 domain)
|
|
746 (while (and props
|
|
747 (face-property-equal face1 face2 (car props) domain))
|
|
748 (setq props (cdr props)))
|
|
749 (null props))
|
|
750
|
|
751 (defun face-equal (face1 face2 &optional domain)
|
|
752 "Return t if FACE1 and FACE2 will display in the same way in DOMAIN.
|
|
753 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
754 (if (null domain) (setq domain (selected-window)))
|
|
755 (if (not (valid-specifier-domain-p domain))
|
|
756 (error "Invalid specifier domain"))
|
|
757 (let ((device (dfw-device domain))
|
|
758 (common-props '(foreground background font display-table underline
|
|
759 dim))
|
|
760 (win-props '(background-pixmap strikethru))
|
|
761 (tty-props '(highlight blinking reverse)))
|
|
762
|
|
763 ;; First check the properties which are used in common between the
|
|
764 ;; x and tty devices. Then, check those properties specific to
|
|
765 ;; the particular device type.
|
|
766 (and (face-equal-loop common-props face1 face2 domain)
|
|
767 (cond ((eq 'tty (device-type device))
|
|
768 (face-equal-loop tty-props face1 face2 domain))
|
462
|
769 ;; #### Why isn't this (console-on-window-system-p (device-console device))?
|
|
770 ;; #### FIXME!
|
428
|
771 ((or (eq 'x (device-type device))
|
462
|
772 (eq 'gtk (device-type device))
|
428
|
773 (eq 'mswindows (device-type device)))
|
|
774 (face-equal-loop win-props face1 face2 domain))
|
|
775 (t t)))))
|
|
776
|
|
777 (defun face-differs-from-default-p (face &optional domain)
|
|
778 "Return t if FACE will display differently from the default face in DOMAIN.
|
|
779 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
780 (not (face-equal face 'default domain)))
|
|
781
|
|
782 ; moved from x-faces.el
|
|
783 (defun try-font-name (name &optional device)
|
|
784 ;; yes, name really should be here twice.
|
|
785 (and name (make-font-instance name device t) name))
|
|
786
|
|
787
|
|
788 ;; This function is a terrible, disgusting hack!!!! Need to
|
|
789 ;; separate out the font elements as separate face properties!
|
|
790
|
|
791 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
792 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
793 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
794 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
795 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
796 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
797 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
798 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
799 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
800 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
801 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
802 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
803 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
804 ;; WE DEMAND LEXICAL SCOPING!!!
|
|
805 ;; WE DEMAND LEXICAL SCOPING!!!
|
442
|
806 (defun frob-face-property (face property func device-tags &optional
|
|
807 locale tags)
|
428
|
808 "Change the specifier for FACE's PROPERTY according to FUNC, in LOCALE.
|
|
809 This function is ugly and messy and is primarily used as an internal
|
|
810 helper function for `make-face-bold' et al., so you probably don't
|
|
811 want to use it or read the rest of the documentation. But if you do ...
|
|
812
|
|
813 FUNC should be a function of two arguments (an instance and a device)
|
|
814 that returns a modified name that is valid for the given device.
|
|
815 If LOCALE specifies a valid domain (i.e. a window, frame, or device),
|
|
816 this function instantiates the specifier over that domain, applies FUNC
|
|
817 to the resulting instance, and adds the result back as an instantiator
|
|
818 for that locale. Otherwise, LOCALE should be a locale, locale type, or
|
|
819 'all (defaults to 'all if omitted). For each specification thusly
|
|
820 included: if the locale given is a valid domain, FUNC will be
|
|
821 iterated over all valid instantiators for the device of the domain
|
|
822 until a non-nil result is found (if there is no such result, the
|
|
823 first valid instantiator is used), and that result substituted for
|
|
824 the specification; otherwise, the process just outlined is
|
|
825 iterated over each existing device and the concatenated results
|
442
|
826 substituted for the specification.
|
|
827
|
|
828 DEVICE-TAGS is a list of tags that each device must match in order for
|
|
829 the function to be called on it."
|
428
|
830 (let ((sp (face-property face property))
|
|
831 temp-sp)
|
|
832 (if (valid-specifier-domain-p locale)
|
|
833 ;; this is easy.
|
|
834 (let* ((inst (face-property-instance face property locale))
|
442
|
835 (name (and inst
|
|
836 (device-matches-specifier-tag-set-p
|
|
837 (dfw-device locale) device-tags)
|
|
838 (funcall func inst (dfw-device locale)))))
|
428
|
839 (when name
|
|
840 (add-spec-to-specifier sp name locale tags)))
|
|
841 ;; otherwise, map over all specifications ...
|
|
842 ;; but first, some further kludging:
|
|
843 ;; (1) if we're frobbing the global property, make sure
|
|
844 ;; that something is there (copy from the default face,
|
|
845 ;; if necessary). Otherwise, something like
|
|
846 ;; (make-face-larger 'modeline)
|
|
847 ;; won't do anything at all if the modeline simply
|
|
848 ;; inherits its font from 'default.
|
|
849 ;; (2) if we're frobbing a particular locale, nothing would
|
|
850 ;; happen if that locale has no instantiators. So signal
|
|
851 ;; an error to indicate this.
|
|
852
|
444
|
853
|
428
|
854 (setq temp-sp (copy-specifier sp))
|
707
|
855 (if (or (eq locale 'global) (eq locale 'all) (not locale))
|
|
856 (when (not (specifier-specs temp-sp 'global))
|
|
857 ;; Try fallback via the official ways and then do it "by hand"
|
|
858 (let* ((fallback (specifier-fallback sp))
|
|
859 (fallback-sp
|
|
860 (cond ((specifierp fallback) fallback)
|
|
861 ;; just an inst list
|
|
862 (fallback
|
|
863 (make-specifier-and-init (specifier-type sp)
|
|
864 fallback))
|
|
865 ((eq (get-face face) (get-face 'default))
|
|
866 (error "Unable to find global specification"))
|
|
867 ;; If no fallback we snoop from default
|
|
868 (t (face-property 'default property)))))
|
|
869 (copy-specifier fallback-sp temp-sp 'global))))
|
428
|
870 (if (and (valid-specifier-locale-p locale)
|
|
871 (not (specifier-specs temp-sp locale)))
|
|
872 (error "Property must have a specification in locale %S" locale))
|
|
873 (map-specifier
|
|
874 temp-sp
|
|
875 (lambda (sp-arg locale inst-list func)
|
|
876 (let* ((device (dfw-device locale))
|
|
877 ;; if a device can be derived from the locale,
|
|
878 ;; call frob-face-property-1 for that device.
|
|
879 ;; Otherwise map frob-face-property-1 over each device.
|
|
880 (result
|
|
881 (if device
|
442
|
882 (list (and (device-matches-specifier-tag-set-p
|
|
883 device device-tags)
|
|
884 (frob-face-property-1 sp-arg device inst-list
|
|
885 func)))
|
428
|
886 (mapcar (lambda (device)
|
442
|
887 (and (device-matches-specifier-tag-set-p
|
|
888 device device-tags)
|
|
889 (frob-face-property-1 sp-arg device
|
|
890 inst-list func)))
|
428
|
891 (device-list))))
|
|
892 new-result)
|
|
893 ;; remove duplicates and nils from the obtained list of
|
|
894 ;; instantiators. Also add tags amd remove 'defaults'.
|
|
895 (mapcar (lambda (arg)
|
|
896 (when arg
|
|
897 (if (not (consp arg))
|
|
898 (setq arg (cons tags arg))
|
|
899 (setcar arg (append tags (delete 'default
|
|
900 (car arg))))))
|
442
|
901 (when (and arg (not (member arg new-result)))
|
428
|
902 (setq new-result (cons arg new-result))))
|
|
903 result)
|
|
904 ;; add back in.
|
|
905 (add-spec-list-to-specifier sp (list (cons locale new-result)))
|
|
906 ;; tell map-specifier to keep going.
|
|
907 nil))
|
|
908 locale
|
|
909 func))))
|
|
910
|
|
911 (defun frob-face-property-1 (sp device inst-list func)
|
|
912 (let
|
|
913 (first-valid result)
|
|
914 (while (and inst-list (not result))
|
|
915 (let* ((inst-pair (car inst-list))
|
|
916 (tag-set (car inst-pair))
|
|
917 (sp-inst (specifier-instance-from-inst-list
|
|
918 sp device (list inst-pair))))
|
|
919 (if sp-inst
|
|
920 (progn
|
|
921 (if (not first-valid)
|
|
922 (setq first-valid inst-pair))
|
|
923 (setq result (funcall func sp-inst device))
|
|
924 (if result
|
|
925 (setq result (cons tag-set result))))))
|
|
926 (setq inst-list (cdr inst-list)))
|
|
927 (or result first-valid)))
|
|
928
|
452
|
929 (defcustom face-frob-from-locale-first nil
|
|
930 "*If non nil, use kludgy way of frobbing fonts suitable for non-mule
|
|
931 multi-charset environments."
|
|
932 :group 'faces
|
|
933 :type 'boolean)
|
|
934
|
428
|
935 (defun frob-face-font-2 (face locale tags unfrobbed-face frobbed-face
|
442
|
936 tty-thunk ws-thunk standard-face-mapping)
|
428
|
937 ;; another kludge to make things more intuitive. If we're
|
|
938 ;; inheriting from a standard face in this locale, frob the
|
442
|
939 ;; inheritance as appropriate. Else, if, after the first
|
|
940 ;; window-system frobbing pass, the face hasn't changed and still
|
|
941 ;; looks like the standard unfrobbed face (e.g. 'default), make it
|
|
942 ;; inherit from the standard frobbed face (e.g. 'bold). Regardless
|
|
943 ;; of things, do the TTY frobbing.
|
428
|
944
|
|
945 ;; yuck -- The LOCALE argument to make-face-bold is not actually a locale,
|
|
946 ;; but is a "locale, locale-type, or nil for all". So ... do our extra
|
|
947 ;; frobbing only if it's actually a locale; or for nil, do the frobbing
|
|
948 ;; on 'global. This specifier stuff needs some rethinking.
|
|
949 (let* ((the-locale (cond ((null locale) 'global)
|
|
950 ((valid-specifier-locale-p locale) locale)
|
|
951 (t nil)))
|
452
|
952 (spec-list
|
|
953 (and
|
|
954 the-locale
|
|
955 (specifier-spec-list (get (get-face face) 'font) the-locale tags t)))
|
|
956 (change-it
|
|
957 (and
|
|
958 spec-list
|
|
959 (cdr (assoc (cdadar spec-list) standard-face-mapping)))))
|
428
|
960 (if (and change-it
|
|
961 (not (memq (face-name (find-face face))
|
|
962 '(default bold italic bold-italic))))
|
|
963 (progn
|
|
964 (or (equal change-it t)
|
452
|
965 (set-face-property face 'font change-it the-locale tags))
|
428
|
966 (funcall tty-thunk))
|
|
967 (let* ((domain (cond ((null the-locale) nil)
|
|
968 ((valid-specifier-domain-p the-locale) the-locale)
|
|
969 ;; OK, this next one is truly a kludge, but
|
|
970 ;; it results in more intuitive behavior most
|
|
971 ;; of the time. (really!)
|
|
972 ((or (eq the-locale 'global) (eq the-locale 'all))
|
|
973 (selected-device))
|
|
974 (t nil)))
|
|
975 (inst (and domain (face-property-instance face 'font domain))))
|
|
976 ;; If it's reasonable to do the inherit-from-standard-face trick,
|
|
977 ;; and it's called for, then do it now.
|
452
|
978 (if (and
|
|
979 face-frob-from-locale-first
|
|
980 (eq the-locale 'global)
|
|
981 domain
|
|
982 (equal inst (face-property-instance face 'font domain))
|
|
983 ;; don't do it for standard faces, or you'll get inheritance loops.
|
|
984 ;; #### This makes XEmacs seg fault! fix this bug.
|
|
985 (not (memq (face-name (find-face face))
|
|
986 '(default bold italic bold-italic)))
|
|
987 (equal (face-property-instance face 'font domain)
|
|
988 (face-property-instance unfrobbed-face 'font domain)))
|
428
|
989 (set-face-property face 'font (vector frobbed-face)
|
452
|
990 the-locale tags)
|
|
991 ;; and only otherwise try to build new property value artificially
|
|
992 (funcall tty-thunk)
|
|
993 (funcall ws-thunk)
|
|
994 (and
|
|
995 domain
|
|
996 (equal inst (face-property-instance face 'font domain))
|
|
997 ;; don't do it for standard faces, or you'll get inheritance loops.
|
|
998 ;; #### This makes XEmacs seg fault! fix this bug.
|
|
999 (not (memq (face-name (find-face face))
|
|
1000 '(default bold italic bold-italic)))
|
|
1001 (equal (face-property-instance face 'font domain)
|
|
1002 (face-property-instance unfrobbed-face 'font domain))
|
|
1003 (set-face-property face 'font (vector frobbed-face) the-locale tags)))))))
|
428
|
1004
|
707
|
1005 ;; WE DEMAND FOUNDRY FROBBING!
|
|
1006
|
|
1007 ;; Family frobbing
|
|
1008 ;; Thx Jan Vroonhof, Ref xemacs-beta <87oflypbum.fsf@petteflet.ntlworld.com>
|
|
1009 ;; Brainlessly derived from make-face-size by Stephen; don't blame Jan.
|
|
1010 ;; I'm long since flown to Rio, it does you little good to blame me, either.
|
|
1011 (defun make-face-family (face family &optional locale tags)
|
|
1012 "Set FACE's family to FAMILY in LOCALE, if possible.
|
|
1013
|
|
1014 Add/replace settings specified by TAGS only."
|
|
1015 (frob-face-property face 'font
|
|
1016 ;; uses dynamic scope of family
|
|
1017 #'(lambda (f d)
|
|
1018 ;; keep the dependency on font.el for now
|
|
1019 (let ((fo (font-create-object (font-instance-name f)
|
|
1020 d)))
|
|
1021 (set-font-family fo family)
|
|
1022 (font-create-name fo d)))
|
|
1023 nil locale tags))
|
|
1024
|
|
1025 ;; Style (ie, typographical face) frobbing
|
428
|
1026 (defun make-face-bold (face &optional locale tags)
|
|
1027 "Make FACE bold in LOCALE, if possible.
|
442
|
1028 This will attempt to make the font bold for X/MSW locales and will set the
|
428
|
1029 highlight flag for TTY locales.
|
|
1030
|
|
1031 If LOCALE is nil, omitted, or `all', this will attempt to frob all
|
|
1032 font specifications for FACE to make them appear bold. Similarly, if
|
|
1033 LOCALE is a locale type, this frobs all font specifications for locales
|
|
1034 of that type. If LOCALE is a particular locale, what happens depends on
|
|
1035 what sort of locale is given. If you gave a device, frame, or window,
|
|
1036 then it's always possible to determine what the font actually will be,
|
|
1037 so this is determined and the resulting font is frobbed and added back as a
|
|
1038 specification for this locale. If LOCALE is a buffer, however, you can't
|
|
1039 determine what the font will actually be unless there's actually a
|
|
1040 specification given for that particular buffer (otherwise, it depends
|
|
1041 on what window and frame the buffer appears in, and might not even be
|
|
1042 well-defined if the buffer appears multiple times in different places);
|
|
1043 therefore you will get an error unless there's a specification for the
|
|
1044 buffer.
|
|
1045
|
|
1046 Finally, in some cases (specifically, when LOCALE is not a locale type),
|
|
1047 if the frobbing didn't actually make the font look any different
|
|
1048 \(this happens, for example, if your font specification is already bold
|
|
1049 or has no bold equivalent), and currently looks like the font of the
|
|
1050 'default face, it is set to inherit from the 'bold face. This is kludgy
|
|
1051 but it makes `make-face-bold' have more intuitive behavior in many
|
|
1052 circumstances."
|
|
1053 (interactive (list (read-face-name "Make which face bold: ")))
|
|
1054 (frob-face-font-2
|
|
1055 face locale tags 'default 'bold
|
|
1056 (lambda ()
|
|
1057 ;; handle TTY specific entries
|
|
1058 (when (featurep 'tty)
|
|
1059 (set-face-highlight-p face t locale (cons 'tty tags))))
|
|
1060 (lambda ()
|
462
|
1061 ;; handle window-system specific entries
|
|
1062 (when (featurep 'gtk)
|
|
1063 (frob-face-property face 'font 'gtk-make-font-bold
|
|
1064 '(gtk) locale tags))
|
428
|
1065 (when (featurep 'x)
|
442
|
1066 (frob-face-property face 'font 'x-make-font-bold
|
|
1067 '(x) locale tags))
|
428
|
1068 (when (featurep 'mswindows)
|
442
|
1069 (frob-face-property face 'font 'mswindows-make-font-bold
|
484
|
1070 '(mswindows) locale tags)
|
|
1071 (frob-face-property face 'font 'mswindows-make-font-bold
|
|
1072 '(msprinter) locale tags))
|
428
|
1073 )
|
|
1074 '(([default] . [bold])
|
|
1075 ([bold] . t)
|
|
1076 ([italic] . [bold-italic])
|
|
1077 ([bold-italic] . t))))
|
|
1078
|
|
1079 (defun make-face-italic (face &optional locale tags)
|
|
1080 "Make FACE italic in LOCALE, if possible.
|
442
|
1081 This will attempt to make the font italic for X/MS Windows locales and
|
|
1082 will set the underline flag for TTY locales. See `make-face-bold' for
|
|
1083 the semantics of the LOCALE argument and for more specifics on exactly
|
|
1084 how this function works."
|
428
|
1085 (interactive (list (read-face-name "Make which face italic: ")))
|
|
1086 (frob-face-font-2
|
|
1087 face locale tags 'default 'italic
|
|
1088 (lambda ()
|
|
1089 ;; handle TTY specific entries
|
|
1090 (when (featurep 'tty)
|
|
1091 (set-face-underline-p face t locale (cons 'tty tags))))
|
|
1092 (lambda ()
|
462
|
1093 ;; handle window-system specific entries
|
|
1094 (when (featurep 'gtk)
|
|
1095 (frob-face-property face 'font 'gtk-make-font-italic
|
|
1096 '(gtk) locale tags))
|
428
|
1097 (when (featurep 'x)
|
442
|
1098 (frob-face-property face 'font 'x-make-font-italic
|
|
1099 '(x) locale tags))
|
428
|
1100 (when (featurep 'mswindows)
|
442
|
1101 (frob-face-property face 'font 'mswindows-make-font-italic
|
484
|
1102 '(mswindows) locale tags)
|
|
1103 (frob-face-property face 'font 'mswindows-make-font-italic
|
|
1104 '(msprinter) locale tags))
|
428
|
1105 )
|
|
1106 '(([default] . [italic])
|
|
1107 ([bold] . [bold-italic])
|
|
1108 ([italic] . t)
|
|
1109 ([bold-italic] . t))))
|
|
1110
|
|
1111 (defun make-face-bold-italic (face &optional locale tags)
|
|
1112 "Make FACE bold and italic in LOCALE, if possible.
|
442
|
1113 This will attempt to make the font bold-italic for X/MS Windows
|
|
1114 locales and will set the highlight and underline flags for TTY
|
|
1115 locales. See `make-face-bold' for the semantics of the LOCALE
|
|
1116 argument and for more specifics on exactly how this function works."
|
428
|
1117 (interactive (list (read-face-name "Make which face bold-italic: ")))
|
|
1118 (frob-face-font-2
|
|
1119 face locale tags 'default 'bold-italic
|
|
1120 (lambda ()
|
|
1121 ;; handle TTY specific entries
|
|
1122 (when (featurep 'tty)
|
|
1123 (set-face-highlight-p face t locale (cons 'tty tags))
|
|
1124 (set-face-underline-p face t locale (cons 'tty tags))))
|
|
1125 (lambda ()
|
462
|
1126 ;; handle window-system specific entries
|
|
1127 (when (featurep 'gtk)
|
|
1128 (frob-face-property face 'font 'gtk-make-font-bold-italic
|
|
1129 '(gtk) locale tags))
|
428
|
1130 (when (featurep 'x)
|
442
|
1131 (frob-face-property face 'font 'x-make-font-bold-italic
|
|
1132 '(x) locale tags))
|
428
|
1133 (when (featurep 'mswindows)
|
442
|
1134 (frob-face-property face 'font 'mswindows-make-font-bold-italic
|
484
|
1135 '(mswindows) locale tags)
|
|
1136 (frob-face-property face 'font 'mswindows-make-font-bold-italic
|
|
1137 '(msprinter) locale tags))
|
428
|
1138 )
|
|
1139 '(([default] . [italic])
|
|
1140 ([bold] . [bold-italic])
|
|
1141 ([italic] . [bold-italic])
|
|
1142 ([bold-italic] . t))))
|
|
1143
|
|
1144 (defun make-face-unbold (face &optional locale tags)
|
|
1145 "Make FACE non-bold in LOCALE, if possible.
|
442
|
1146 This will attempt to make the font non-bold for X/MS Windows locales
|
|
1147 and will unset the highlight flag for TTY locales. See
|
|
1148 `make-face-bold' for the semantics of the LOCALE argument and for more
|
|
1149 specifics on exactly how this function works."
|
428
|
1150 (interactive (list (read-face-name "Make which face non-bold: ")))
|
|
1151 (frob-face-font-2
|
|
1152 face locale tags 'bold 'default
|
|
1153 (lambda ()
|
|
1154 ;; handle TTY specific entries
|
|
1155 (when (featurep 'tty)
|
|
1156 (set-face-highlight-p face nil locale (cons 'tty tags))))
|
|
1157 (lambda ()
|
462
|
1158 ;; handle window-system specific entries
|
|
1159 (when (featurep 'gtk)
|
|
1160 (frob-face-property face 'font 'gtk-make-font-unbold
|
|
1161 '(gtk) locale tags))
|
428
|
1162 (when (featurep 'x)
|
442
|
1163 (frob-face-property face 'font 'x-make-font-unbold
|
|
1164 '(x) locale tags))
|
428
|
1165 (when (featurep 'mswindows)
|
442
|
1166 (frob-face-property face 'font 'mswindows-make-font-unbold
|
484
|
1167 '(mswindows) locale tags)
|
|
1168 (frob-face-property face 'font 'mswindows-make-font-unbold
|
|
1169 '(msprinter) locale tags))
|
428
|
1170 )
|
|
1171 '(([default] . t)
|
|
1172 ([bold] . [default])
|
|
1173 ([italic] . t)
|
|
1174 ([bold-italic] . [italic]))))
|
|
1175
|
|
1176 (defun make-face-unitalic (face &optional locale tags)
|
|
1177 "Make FACE non-italic in LOCALE, if possible.
|
442
|
1178 This will attempt to make the font non-italic for X/MS Windows locales
|
|
1179 and will unset the underline flag for TTY locales. See
|
|
1180 `make-face-bold' for the semantics of the LOCALE argument and for more
|
|
1181 specifics on exactly how this function works."
|
428
|
1182 (interactive (list (read-face-name "Make which face non-italic: ")))
|
|
1183 (frob-face-font-2
|
|
1184 face locale tags 'italic 'default
|
|
1185 (lambda ()
|
|
1186 ;; handle TTY specific entries
|
|
1187 (when (featurep 'tty)
|
|
1188 (set-face-underline-p face nil locale (cons 'tty tags))))
|
|
1189 (lambda ()
|
462
|
1190 ;; handle window-system specific entries
|
|
1191 (when (featurep 'gtk)
|
|
1192 (frob-face-property face 'font 'gtk-make-font-unitalic
|
|
1193 '(gtk) locale tags))
|
428
|
1194 (when (featurep 'x)
|
442
|
1195 (frob-face-property face 'font 'x-make-font-unitalic
|
|
1196 '(x) locale tags))
|
428
|
1197 (when (featurep 'mswindows)
|
442
|
1198 (frob-face-property face 'font 'mswindows-make-font-unitalic
|
484
|
1199 '(mswindows) locale tags)
|
|
1200 (frob-face-property face 'font 'mswindows-make-font-unitalic
|
|
1201 '(msprinter) locale tags))
|
428
|
1202 )
|
|
1203 '(([default] . t)
|
|
1204 ([bold] . t)
|
|
1205 ([italic] . [default])
|
|
1206 ([bold-italic] . [bold]))))
|
|
1207
|
|
1208
|
707
|
1209 ;; Size frobbing
|
|
1210 ;; Thx Jan Vroonhof, Ref xemacs-beta <87oflypbum.fsf@petteflet.ntlworld.com>
|
|
1211 ;; Jan had a separate helper function
|
|
1212 (defun make-face-size (face size &optional locale tags)
|
|
1213 "Adjust FACE to SIZE in LOCALE, if possible.
|
|
1214
|
|
1215 Add/replace settings specified by TAGS only."
|
|
1216 (frob-face-property face 'font
|
|
1217 ;; uses dynamic scope of size
|
|
1218 #'(lambda (f d)
|
|
1219 ;; keep the dependency on font.el for now
|
|
1220 (let ((fo (font-create-object (font-instance-name f)
|
|
1221 d)))
|
|
1222 (set-font-size fo size)
|
|
1223 (font-create-name fo d)))
|
|
1224 nil locale tags))
|
|
1225
|
428
|
1226 ;; Why do the following two functions lose so badly in so many
|
|
1227 ;; circumstances?
|
|
1228
|
|
1229 (defun make-face-smaller (face &optional locale)
|
|
1230 "Make the font of FACE be smaller, if possible.
|
|
1231 LOCALE works as in `make-face-bold' et al., but the ``inheriting-
|
|
1232 from-the-bold-face'' operations described there are not done
|
|
1233 because they don't make sense in this context."
|
|
1234 (interactive (list (read-face-name "Shrink which face: ")))
|
|
1235 ;; handle X specific entries
|
|
1236 (when (featurep 'x)
|
442
|
1237 (frob-face-property face 'font 'x-find-smaller-font
|
|
1238 '(x) locale))
|
428
|
1239 (when (featurep 'mswindows)
|
442
|
1240 (frob-face-property face 'font 'mswindows-find-smaller-font
|
484
|
1241 '(mswindows) locale)
|
|
1242 (frob-face-property face 'font 'mswindows-find-smaller-font
|
|
1243 '(msprinter) locale)))
|
428
|
1244
|
|
1245 (defun make-face-larger (face &optional locale)
|
|
1246 "Make the font of FACE be larger, if possible.
|
|
1247 See `make-face-smaller' for the semantics of the LOCALE argument."
|
|
1248 (interactive (list (read-face-name "Enlarge which face: ")))
|
|
1249 ;; handle X specific entries
|
|
1250 (when (featurep 'x)
|
442
|
1251 (frob-face-property face 'font 'x-find-larger-font
|
|
1252 '(x) locale))
|
428
|
1253 (when (featurep 'mswindows)
|
442
|
1254 (frob-face-property face 'font 'mswindows-find-larger-font
|
484
|
1255 '(mswindows) locale)
|
|
1256 (frob-face-property face 'font 'mswindows-find-larger-font
|
|
1257 '(msprinter) locale)))
|
428
|
1258
|
|
1259 (defun invert-face (face &optional locale)
|
|
1260 "Swap the foreground and background colors of the face."
|
|
1261 (interactive (list (read-face-name "Invert face: ")))
|
|
1262 (if (valid-specifier-domain-p locale)
|
|
1263 (let ((foreface (face-foreground-instance face locale)))
|
|
1264 (set-face-foreground face (face-background-instance face locale)
|
|
1265 locale)
|
|
1266 (set-face-background face foreface locale))
|
|
1267 (let ((forespec (copy-specifier (face-foreground face) nil locale)))
|
|
1268 (copy-specifier (face-background face) (face-foreground face) locale)
|
|
1269 (copy-specifier forespec (face-background face) locale))))
|
|
1270
|
|
1271
|
|
1272 ;;; Convenience functions
|
|
1273
|
|
1274 (defun face-ascent (face &optional domain charset)
|
|
1275 "Return the ascent of FACE in DOMAIN.
|
|
1276 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
1277 (font-ascent (face-font face) domain charset))
|
|
1278
|
|
1279 (defun face-descent (face &optional domain charset)
|
|
1280 "Return the descent of FACE in DOMAIN.
|
|
1281 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
1282 (font-descent (face-font face) domain charset))
|
|
1283
|
|
1284 (defun face-width (face &optional domain charset)
|
|
1285 "Return the width of FACE in DOMAIN.
|
|
1286 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
1287 (font-width (face-font face) domain charset))
|
|
1288
|
|
1289 (defun face-height (face &optional domain charset)
|
|
1290 "Return the height of FACE in DOMAIN.
|
|
1291 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
1292 (+ (face-ascent face domain charset) (face-descent face domain charset)))
|
|
1293
|
|
1294 (defun face-proportional-p (face &optional domain charset)
|
|
1295 "Return t if FACE is proportional in DOMAIN.
|
|
1296 See `face-property-instance' for the semantics of the DOMAIN argument."
|
|
1297 (font-proportional-p (face-font face) domain charset))
|
|
1298
|
|
1299
|
|
1300 ;; Functions that used to be in cus-face.el, but logically go here.
|
|
1301
|
|
1302 (defcustom frame-background-mode nil
|
|
1303 "*The brightness of the background.
|
|
1304 Set this to the symbol dark if your background color is dark, light if
|
|
1305 your background is light, or nil (default) if you want Emacs to
|
|
1306 examine the brightness for you."
|
|
1307 :group 'faces
|
|
1308 :type '(choice (choice-item dark)
|
|
1309 (choice-item light)
|
|
1310 (choice-item :tag "Auto" nil)))
|
|
1311
|
|
1312 ;; The old variable that many people still have in .emacs files.
|
|
1313 (define-obsolete-variable-alias 'custom-background-mode
|
|
1314 'frame-background-mode)
|
|
1315
|
|
1316 (defun get-frame-background-mode (frame)
|
|
1317 "Detect background mode for FRAME."
|
|
1318 (let* ((color-instance (face-background-instance 'default frame))
|
|
1319 (mode (condition-case nil
|
|
1320 (if (< (apply '+ (color-instance-rgb-components
|
|
1321 color-instance)) 65536)
|
|
1322 'dark 'light)
|
|
1323 ;; Here, we get an error on a TTY. As we don't have
|
|
1324 ;; a good way of detecting whether a TTY is light or
|
|
1325 ;; dark, we'll guess it's dark.
|
|
1326 (error 'dark))))
|
|
1327 (set-frame-property frame 'background-mode mode)
|
|
1328 mode))
|
|
1329
|
|
1330 (defun extract-custom-frame-properties (frame)
|
|
1331 "Return a plist with the frame properties of FRAME used by custom."
|
|
1332 (list 'type (or (frame-property frame 'display-type)
|
|
1333 (device-type (frame-device frame)))
|
|
1334 'class (device-class (frame-device frame))
|
|
1335 'background (or frame-background-mode
|
|
1336 (frame-property frame 'background-mode)
|
|
1337 (get-frame-background-mode frame))))
|
|
1338
|
|
1339 (defcustom init-face-from-resources t
|
|
1340 "If non nil, attempt to initialize faces from the resource database."
|
|
1341 :group 'faces
|
|
1342 :type 'boolean)
|
|
1343
|
|
1344 ;; Old name, used by custom. Also, FSFmacs name.
|
|
1345 (defvaralias 'initialize-face-resources 'init-face-from-resources)
|
|
1346
|
|
1347 ;; Make sure all custom setting are added with this tag so we can
|
|
1348 ;; identify-them
|
|
1349 (define-specifier-tag 'custom)
|
|
1350
|
|
1351 (defun face-spec-set (face spec &optional frame tags)
|
|
1352 "Set FACE's face attributes according to the first matching entry in SPEC.
|
|
1353 If optional FRAME is non-nil, set it for that frame only.
|
|
1354 If it is nil, then apply SPEC to each frame individually.
|
|
1355 See `defface' for information about SPEC."
|
|
1356 (if frame
|
|
1357 (progn
|
|
1358 (reset-face face frame tags)
|
|
1359 (face-display-set face spec frame tags)
|
|
1360 (init-face-from-resources face frame))
|
|
1361 (let ((frames (relevant-custom-frames)))
|
|
1362 (reset-face face nil tags)
|
|
1363 ;; This should not be needed. We only remove our own specifiers
|
|
1364 ;; (if (and (eq 'default face) (featurep 'x))
|
|
1365 ;; (x-init-global-faces))
|
|
1366 (face-display-set face spec nil tags)
|
|
1367 (while frames
|
|
1368 (face-display-set face spec (car frames) tags)
|
|
1369 (pop frames))
|
|
1370 (init-face-from-resources face))))
|
|
1371
|
|
1372 (defun face-display-set (face spec &optional frame tags)
|
|
1373 "Set FACE to the attributes to the first matching entry in SPEC.
|
|
1374 Iff optional FRAME is non-nil, set it for that frame only.
|
|
1375 See `defface' for information about SPEC."
|
|
1376 (while spec
|
|
1377 (let ((display (caar spec))
|
|
1378 (atts (cadar spec)))
|
|
1379 (pop spec)
|
|
1380 (when (face-spec-set-match-display display frame)
|
|
1381 ;; Avoid creating frame local duplicates of the global face.
|
|
1382 (unless (and frame (eq display (get face 'custom-face-display)))
|
|
1383 (apply 'face-custom-attributes-set face frame tags atts))
|
|
1384 (unless frame
|
|
1385 (put face 'custom-face-display display))
|
|
1386 (setq spec nil)))))
|
|
1387
|
|
1388 (defvar default-custom-frame-properties nil
|
|
1389 "The frame properties used for the global faces.
|
442
|
1390 Frames not matching these properties should have frame local faces.
|
428
|
1391 The value should be nil, if uninitialized, or a plist otherwise.
|
|
1392 See `defface' for a list of valid keys and values for the plist.")
|
|
1393
|
|
1394 (defun get-custom-frame-properties (&optional frame)
|
|
1395 "Return a plist with the frame properties of FRAME used by custom.
|
|
1396 If FRAME is nil, return the default frame properties."
|
|
1397 (cond (frame
|
|
1398 ;; Try to get from cache.
|
|
1399 (let ((cache (frame-property frame 'custom-properties)))
|
|
1400 (unless cache
|
|
1401 ;; Oh well, get it then.
|
|
1402 (setq cache (extract-custom-frame-properties frame))
|
|
1403 ;; and cache it...
|
|
1404 (set-frame-property frame 'custom-properties cache))
|
|
1405 cache))
|
|
1406 (default-custom-frame-properties)
|
|
1407 (t
|
|
1408 (setq default-custom-frame-properties
|
|
1409 (extract-custom-frame-properties (selected-frame))))))
|
|
1410
|
|
1411 (defun face-spec-update-all-matching (spec display plist)
|
|
1412 "Update all entries in the face spec that could match display to
|
444
|
1413 have the entries from the new plist and return the new spec."
|
428
|
1414 (mapcar
|
|
1415 (lambda (e)
|
|
1416 (let ((entries (car e))
|
|
1417 (options (cadr e))
|
|
1418 (match t)
|
|
1419 dplist
|
|
1420 (new-options plist)
|
|
1421 )
|
|
1422 (unless (eq display t)
|
|
1423 (mapc (lambda (arg)
|
|
1424 (setq dplist (plist-put dplist (car arg) (cadr arg))))
|
|
1425 display))
|
|
1426 (unless (eq entries t)
|
|
1427 (mapc (lambda (arg)
|
|
1428 (setq match (and match (eq (cadr arg)
|
|
1429 (plist-get
|
|
1430 dplist (car arg)
|
|
1431 (cadr arg))))))
|
|
1432 entries))
|
|
1433 (if (not match)
|
|
1434 e
|
|
1435 (while new-options
|
|
1436 (setq options
|
|
1437 (plist-put options (car new-options) (cadr new-options)))
|
|
1438 (setq new-options (cddr new-options)))
|
|
1439 (list entries options))))
|
|
1440 (copy-sequence spec)))
|
444
|
1441
|
|
1442
|
428
|
1443
|
|
1444 (defun face-spec-set-match-display (display &optional frame)
|
|
1445 "Return non-nil if DISPLAY matches FRAME.
|
|
1446 DISPLAY is part of a spec such as can be used in `defface'.
|
|
1447 If FRAME is nil or omitted, the selected frame is used."
|
|
1448 (if (eq display t)
|
|
1449 t
|
|
1450 (let* ((props (get-custom-frame-properties frame))
|
|
1451 (type (plist-get props 'type))
|
|
1452 (class (plist-get props 'class))
|
|
1453 (background (plist-get props 'background))
|
|
1454 (match t)
|
|
1455 (entries display)
|
|
1456 entry req options)
|
|
1457 (while (and entries match)
|
|
1458 (setq entry (car entries)
|
|
1459 entries (cdr entries)
|
|
1460 req (car entry)
|
|
1461 options (cdr entry)
|
|
1462 match (case req
|
|
1463 (type (memq type options))
|
|
1464 (class (memq class options))
|
|
1465 (background (memq background options))
|
|
1466 (t (warn "Unknown req `%S' with options `%S'"
|
|
1467 req options)
|
|
1468 nil))))
|
|
1469 match)))
|
|
1470
|
|
1471 (defun relevant-custom-frames ()
|
|
1472 "List of frames whose custom properties differ from the default."
|
|
1473 (let ((relevant nil)
|
|
1474 (default (get-custom-frame-properties))
|
|
1475 (frames (frame-list))
|
|
1476 frame)
|
|
1477 (while frames
|
|
1478 (setq frame (car frames)
|
|
1479 frames (cdr frames))
|
|
1480 (unless (equal default (get-custom-frame-properties frame))
|
|
1481 (push frame relevant)))
|
|
1482 relevant))
|
|
1483
|
|
1484 (defun initialize-custom-faces (&optional frame)
|
|
1485 "Initialize all custom faces for FRAME.
|
|
1486 If FRAME is nil or omitted, initialize them for all frames."
|
|
1487 (mapc (lambda (symbol)
|
|
1488 (let ((spec (or (get symbol 'saved-face)
|
|
1489 (get symbol 'face-defface-spec))))
|
|
1490 (when spec
|
|
1491 ;; No need to init-face-from-resources -- code in
|
|
1492 ;; `init-frame-faces' does it already.
|
|
1493 (face-display-set symbol spec frame))))
|
|
1494 (face-list)))
|
|
1495
|
|
1496 (defun custom-initialize-frame (frame)
|
|
1497 "Initialize frame-local custom faces for FRAME if necessary."
|
|
1498 (unless (equal (get-custom-frame-properties)
|
|
1499 (get-custom-frame-properties frame))
|
|
1500 (initialize-custom-faces frame)))
|
|
1501
|
440
|
1502 (defun startup-initialize-custom-faces ()
|
|
1503 "Reset faces created by defface. Only called at startup.
|
|
1504 Don't use this function in your program."
|
|
1505 (when default-custom-frame-properties
|
|
1506 ;; Reset default value to the actual frame, not stream.
|
|
1507 (setq default-custom-frame-properties
|
|
1508 (extract-custom-frame-properties (selected-frame)))
|
|
1509 ;; like initialize-custom-faces but removes property first.
|
|
1510 (mapc (lambda (symbol)
|
|
1511 (let ((spec (or (get symbol 'saved-face)
|
|
1512 (get symbol 'face-defface-spec))))
|
|
1513 (when spec
|
|
1514 ;; Reset faces created during auto-autoloads loading.
|
|
1515 (reset-face symbol)
|
|
1516 ;; And set it according to the spec.
|
|
1517 (face-display-set symbol spec nil))))
|
|
1518 (face-list))))
|
|
1519
|
428
|
1520
|
|
1521 (defun make-empty-face (name &optional doc-string temporary)
|
|
1522 "Like `make-face', but doesn't query the resource database."
|
|
1523 (let ((init-face-from-resources nil))
|
|
1524 (make-face name doc-string temporary)))
|
|
1525
|
|
1526 (defun init-face-from-resources (face &optional locale)
|
|
1527 "Initialize FACE from the resource database.
|
|
1528 If LOCALE is specified, it should be a frame, device, or 'global, and
|
|
1529 the face will be resourced over that locale. Otherwise, the face will
|
|
1530 be resourced over all possible locales (i.e. all frames, all devices,
|
|
1531 and 'global)."
|
|
1532 (cond ((null init-face-from-resources)
|
|
1533 ;; Do nothing.
|
|
1534 )
|
|
1535 ((not locale)
|
|
1536 ;; Global, set for all frames.
|
|
1537 (progn
|
|
1538 (init-face-from-resources face 'global)
|
|
1539 (let ((devices (device-list)))
|
|
1540 (while devices
|
|
1541 (init-face-from-resources face (car devices))
|
|
1542 (setq devices (cdr devices))))
|
|
1543 (let ((frames (frame-list)))
|
|
1544 (while frames
|
|
1545 (init-face-from-resources face (car frames))
|
|
1546 (setq frames (cdr frames))))))
|
|
1547 (t
|
|
1548 ;; Specific.
|
|
1549 (let ((devtype (cond ((devicep locale) (device-type locale))
|
|
1550 ((framep locale) (frame-type locale))
|
|
1551 (t nil))))
|
|
1552 (cond ((or (and (not devtype) (featurep 'x)) (eq 'x devtype))
|
502
|
1553 (declare-fboundp (x-init-face-from-resources face locale)))
|
428
|
1554 ((or (not devtype) (eq 'tty devtype))
|
|
1555 ;; Nothing to do for TTYs?
|
|
1556 ))))))
|
|
1557
|
|
1558 (defun init-device-faces (device)
|
|
1559 ;; First, add any device-local face resources.
|
|
1560 (when init-face-from-resources
|
|
1561 (loop for face in (face-list) do
|
|
1562 (init-face-from-resources face device))
|
|
1563 ;; Then do any device-specific initialization.
|
|
1564 (cond ((eq 'x (device-type device))
|
502
|
1565 (declare-fboundp (x-init-device-faces device)))
|
462
|
1566 ((eq 'gtk (device-type device))
|
502
|
1567 (declare-fboundp (gtk-init-device-faces device)))
|
428
|
1568 ((eq 'mswindows (device-type device))
|
502
|
1569 (declare-fboundp (mswindows-init-device-faces device)))
|
428
|
1570 ;; Nothing to do for TTYs?
|
|
1571 )
|
|
1572 (or (eq 'stream (device-type device))
|
|
1573 (init-other-random-faces device))))
|
|
1574
|
|
1575 (defun init-frame-faces (frame)
|
|
1576 (when init-face-from-resources
|
|
1577 ;; First, add any frame-local face resources.
|
|
1578 (loop for face in (face-list) do
|
|
1579 (init-face-from-resources face frame))
|
|
1580 ;; Then do any frame-specific initialization.
|
|
1581 (cond ((eq 'x (frame-type frame))
|
502
|
1582 (declare-fboundp (x-init-frame-faces frame)))
|
462
|
1583 ((eq 'gtk (frame-type frame))
|
502
|
1584 (declare-fboundp (gtk-init-frame-faces frame)))
|
428
|
1585 ((eq 'mswindows (frame-type frame))
|
502
|
1586 (declare-fboundp (mswindows-init-frame-faces frame)))
|
428
|
1587 ;; Is there anything which should be done for TTY's?
|
|
1588 )))
|
|
1589
|
|
1590 ;; #### This is somewhat X-specific, and is called when the first
|
|
1591 ;; X device is created (even if there were TTY devices created
|
|
1592 ;; beforehand). The concept of resources has not been generalized
|
|
1593 ;; outside of X-specificness, so we have to live with this
|
|
1594 ;; breach of device-independence.
|
|
1595
|
|
1596 (defun init-global-faces ()
|
|
1597 ;; Look for global face resources.
|
|
1598 (loop for face in (face-list) do
|
|
1599 (init-face-from-resources face 'global))
|
|
1600 ;; Further X frobbing.
|
502
|
1601 (and (featurep 'x) (declare-fboundp (x-init-global-faces)))
|
|
1602 (and (featurep 'gtk) (declare-fboundp (gtk-init-global-faces)))
|
462
|
1603
|
428
|
1604 ;; for bold and the like, make the global specification be bold etc.
|
|
1605 ;; if the user didn't already specify a value. These will also be
|
|
1606 ;; frobbed further in init-other-random-faces.
|
|
1607 (unless (face-font 'bold 'global)
|
|
1608 (make-face-bold 'bold 'global))
|
|
1609 ;;
|
|
1610 (unless (face-font 'italic 'global)
|
|
1611 (make-face-italic 'italic 'global))
|
|
1612 ;;
|
|
1613 (unless (face-font 'bold-italic 'global)
|
|
1614 (make-face-bold-italic 'bold-italic 'global)
|
|
1615 (unless (face-font 'bold-italic 'global)
|
|
1616 (copy-face 'bold 'bold-italic)
|
|
1617 (make-face-italic 'bold-italic)))
|
|
1618
|
|
1619 (when (face-equal 'bold 'bold-italic)
|
|
1620 (copy-face 'italic 'bold-italic)
|
|
1621 (make-face-bold 'bold-italic))
|
|
1622 ;;
|
|
1623 ;; Nothing more to be done for X or TTY's?
|
|
1624 )
|
|
1625
|
|
1626
|
|
1627 ;; These warnings are there for a reason. Just specify your fonts
|
|
1628 ;; correctly. Deal with it. Additionally, one can use
|
|
1629 ;; `log-warning-minimum-level' instead of this.
|
|
1630 ;(defvar inhibit-font-complaints nil
|
|
1631 ; "Whether to suppress complaints about incomplete sets of fonts.")
|
|
1632
|
|
1633 (defun face-complain-about-font (face device)
|
|
1634 (if (symbolp face) (setq face (symbol-name face)))
|
|
1635 ;; (if (not inhibit-font-complaints)
|
707
|
1636 ;; complaining for printers is generally annoying.
|
|
1637 (unless (device-printer-p device)
|
|
1638 (display-warning
|
|
1639 'font
|
|
1640 (let ((default-name (face-font-name 'default device)))
|
|
1641 (format "%s: couldn't deduce %s %s version of the font
|
428
|
1642 %S.
|
|
1643
|
|
1644 Please specify X resources to make the %s face
|
|
1645 visually distinguishable from the default face.
|
|
1646 For example, you could add one of the following to $HOME/Emacs:
|
|
1647
|
|
1648 Emacs.%s.attributeFont: -dt-*-medium-i-*
|
|
1649 or
|
|
1650 Emacs.%s.attributeForeground: hotpink\n"
|
707
|
1651 invocation-name
|
|
1652 (if (string-match "\\`[aeiouAEIOU]" face) "an" "a")
|
|
1653 face
|
|
1654 default-name
|
|
1655 face
|
|
1656 face
|
|
1657 face
|
|
1658 )))))
|
428
|
1659
|
|
1660
|
|
1661 ;; #### This is quite a mess. We should use the custom mechanism for
|
|
1662 ;; most of this stuff. Currently we don't do it, because Custom
|
|
1663 ;; doesn't use specifiers (yet.) FSF does it the Right Way.
|
|
1664
|
|
1665 ;; For instance, the definition of `bold' should be something like
|
|
1666 ;; (defface bold ((t (:bold t))) "Bold text.") -- and `:bold t' should
|
|
1667 ;; make sure that everything works properly.
|
|
1668
|
|
1669 (defun init-other-random-faces (device)
|
|
1670 "Initialize the colors and fonts of the bold, italic, bold-italic,
|
|
1671 zmacs-region, list-mode-item-selected, highlight, primary-selection,
|
|
1672 secondary-selection, and isearch faces when each device is created. If
|
|
1673 you want to add code to do stuff like this, use the create-device-hook."
|
|
1674
|
|
1675 ;; try to make 'bold look different from the default on this device.
|
|
1676 ;; If that doesn't work at all, then issue a warning.
|
|
1677 (unless (face-differs-from-default-p 'bold device)
|
|
1678 (make-face-bold 'bold device)
|
|
1679 (unless (face-differs-from-default-p 'bold device)
|
|
1680 (make-face-unbold 'bold device)
|
|
1681 (unless (face-differs-from-default-p 'bold device)
|
|
1682 ;; the luser specified one of the bogus font names
|
|
1683 (face-complain-about-font 'bold device))))
|
|
1684
|
|
1685 ;; Similar for italic.
|
|
1686 ;; It's unreasonable to expect to be able to make a font italic all
|
|
1687 ;; the time. For many languages, italic is an alien concept.
|
|
1688 ;; Basically, because italic is not a globally meaningful concept,
|
440
|
1689 ;; the use of the italic face should really be obsoleted.
|
428
|
1690
|
|
1691 ;; I disagree with above. In many languages, the concept of capital
|
|
1692 ;; letters is just as alien, and yet we use them. Italic is here to
|
|
1693 ;; stay. -hniksic
|
|
1694
|
|
1695 ;; In a Solaris Japanese environment, there just aren't any italic
|
|
1696 ;; fonts - period. CDE recognizes this reality, and fonts
|
|
1697 ;; -dt-interface user-medium-r-normal-*-*-*-*-*-*-*-*-* don't come
|
|
1698 ;; in italic versions. So we first try to make the font bold before
|
|
1699 ;; complaining.
|
|
1700 (unless (face-differs-from-default-p 'italic device)
|
|
1701 (make-face-italic 'italic device)
|
|
1702 (unless (face-differs-from-default-p 'italic device)
|
|
1703 (make-face-bold 'italic device)
|
|
1704 (unless (face-differs-from-default-p 'italic device)
|
|
1705 (face-complain-about-font 'italic device))))
|
|
1706
|
|
1707 ;; similar for bold-italic.
|
|
1708 (unless (face-differs-from-default-p 'bold-italic device)
|
|
1709 (make-face-bold-italic 'bold-italic device)
|
|
1710 ;; if we couldn't get a bold-italic version, try just bold.
|
|
1711 (unless (face-differs-from-default-p 'bold-italic device)
|
|
1712 (make-face-bold 'bold-italic device)
|
|
1713 ;; if we couldn't get bold or bold-italic, then that's probably because
|
|
1714 ;; the default font is bold, so make the `bold-italic' face be unbold.
|
|
1715 (unless (face-differs-from-default-p 'bold-italic device)
|
|
1716 (make-face-unbold 'bold-italic device)
|
|
1717 (make-face-italic 'bold-italic device)
|
|
1718 (unless (face-differs-from-default-p 'bold-italic device)
|
|
1719 ;; if that didn't work, try plain italic
|
|
1720 ;; (can this ever happen? what the hell.)
|
|
1721 (make-face-italic 'bold-italic device)
|
|
1722 (unless (face-differs-from-default-p 'bold-italic device)
|
|
1723 ;; then bitch and moan.
|
|
1724 (face-complain-about-font 'bold-italic device))))))
|
|
1725
|
|
1726 ;; Set the text-cursor colors unless already specified.
|
|
1727 (when (and (not (eq 'tty (device-type device)))
|
|
1728 (not (face-background 'text-cursor 'global))
|
|
1729 (face-property-equal 'text-cursor 'default 'background device))
|
|
1730 (set-face-background 'text-cursor [default foreground] 'global
|
|
1731 nil 'append))
|
|
1732 (when (and (not (eq 'tty (device-type device)))
|
|
1733 (not (face-foreground 'text-cursor 'global))
|
|
1734 (face-property-equal 'text-cursor 'default 'foreground device))
|
|
1735 (set-face-foreground 'text-cursor [default background] 'global
|
|
1736 nil 'append))
|
|
1737 )
|
|
1738
|
442
|
1739 ;; New function with 20.1, suggested by Per Abrahamsen, coded by Kyle
|
|
1740 ;; Jones and Hrvoje Niksic.
|
428
|
1741 (defun set-face-stipple (face pixmap &optional frame)
|
|
1742 "Change the stipple pixmap of FACE to PIXMAP.
|
|
1743 This is an Emacs compatibility function; consider using
|
|
1744 set-face-background-pixmap instead.
|
|
1745
|
|
1746 PIXMAP should be a string, the name of a file of pixmap data.
|
442
|
1747 The directories listed in the variables `x-bitmap-file-path' and
|
|
1748 `mswindows-bitmap-file-path' under X and MS Windows respectively
|
|
1749 are searched.
|
428
|
1750
|
|
1751 Alternatively, PIXMAP may be a list of the form (WIDTH HEIGHT
|
|
1752 DATA) where WIDTH and HEIGHT are the size in pixels, and DATA is
|
|
1753 a string, containing the raw bits of the bitmap. XBM data is
|
|
1754 expected in this case, other types of image data will not work.
|
|
1755
|
|
1756 If the optional FRAME argument is provided, change only
|
|
1757 in that frame; otherwise change each frame."
|
|
1758 (while (not (find-face face))
|
446
|
1759 (setq face (wrong-type-argument 'facep face)))
|
502
|
1760 (let ((bitmap-path
|
|
1761 (ecase (console-type)
|
|
1762 (x (declare-boundp x-bitmap-file-path))
|
|
1763 (mswindows (declare-boundp mswindows-bitmap-file-path))))
|
442
|
1764 instantiator)
|
|
1765 (while
|
|
1766 (null
|
|
1767 (setq instantiator
|
|
1768 (cond ((stringp pixmap)
|
|
1769 (let ((file (if (file-name-absolute-p pixmap)
|
|
1770 pixmap
|
|
1771 (locate-file pixmap bitmap-path
|
|
1772 '(".xbm" "")))))
|
|
1773 (and file
|
|
1774 `[xbm :file ,file])))
|
|
1775 ((and (listp pixmap) (= (length pixmap) 3))
|
|
1776 `[xbm :data ,pixmap])
|
|
1777 (t nil))))
|
|
1778 ;; We're signaling a continuable error; let's make sure the
|
|
1779 ;; function `stipple-pixmap-p' at least exists.
|
|
1780 (flet ((stipple-pixmap-p (pixmap)
|
|
1781 (or (stringp pixmap)
|
|
1782 (and (listp pixmap) (= (length pixmap) 3)))))
|
|
1783 (setq pixmap (signal 'wrong-type-argument
|
|
1784 (list 'stipple-pixmap-p pixmap)))))
|
446
|
1785 (check-type frame (or null frame))
|
442
|
1786 (set-face-background-pixmap face instantiator frame)))
|
428
|
1787
|
|
1788
|
|
1789 ;; Create the remaining standard faces now. This way, packages that we dump
|
|
1790 ;; can reference these faces as parents.
|
|
1791 ;;
|
|
1792 ;; The default, modeline, left-margin, right-margin, text-cursor,
|
|
1793 ;; and pointer faces are created in C.
|
|
1794
|
|
1795 (make-face 'bold "Bold text.")
|
|
1796 (make-face 'italic "Italic text.")
|
|
1797 (make-face 'bold-italic "Bold-italic text.")
|
|
1798 (make-face 'underline "Underlined text.")
|
|
1799 (or (face-differs-from-default-p 'underline)
|
|
1800 (set-face-underline-p 'underline t 'global '(default)))
|
735
|
1801 (make-face 'zmacs-region "Used on highlighted region between point and mark.")
|
428
|
1802 (make-face 'isearch "Used on region matched by isearch.")
|
|
1803 (make-face 'isearch-secondary "Face to use for highlighting all matches.")
|
|
1804 (make-face 'list-mode-item-selected
|
|
1805 "Face for the selected list item in list-mode.")
|
|
1806 (make-face 'highlight "Highlight face.")
|
|
1807 (make-face 'primary-selection "Primary selection face.")
|
|
1808 (make-face 'secondary-selection "Secondary selection face.")
|
|
1809
|
|
1810 ;; Several useful color faces.
|
|
1811 (dolist (color '(red green blue yellow))
|
|
1812 (make-face color (concat (symbol-name color) " text."))
|
|
1813 (set-face-foreground color (symbol-name color) nil 'color))
|
|
1814
|
|
1815 ;; Make some useful faces. This happens very early, before creating
|
|
1816 ;; the first non-stream device.
|
|
1817
|
|
1818 (set-face-background 'text-cursor
|
711
|
1819 '(((win default) . "Red3"))
|
428
|
1820 'global)
|
|
1821
|
|
1822 ;; some older X servers don't recognize "darkseagreen2"
|
|
1823 (set-face-background 'highlight
|
711
|
1824 '(((win default color) . "darkseagreen2")
|
|
1825 ((win default color) . "green")
|
|
1826 ((win default grayscale) . "gray53"))
|
428
|
1827 'global)
|
|
1828 (set-face-background-pixmap 'highlight
|
711
|
1829 '(((win default mono) . "gray1"))
|
428
|
1830 'global)
|
|
1831
|
|
1832 (set-face-background 'zmacs-region
|
711
|
1833 '(((win default color) . "gray65")
|
|
1834 ((win default grayscale) . "gray65"))
|
428
|
1835 'global)
|
|
1836 (set-face-background-pixmap 'zmacs-region
|
711
|
1837 '(((win default mono) . "gray3"))
|
428
|
1838 'global)
|
|
1839
|
|
1840 (set-face-background 'list-mode-item-selected
|
711
|
1841 '(((win default color) . "gray68")
|
|
1842 ((win default grayscale) . "gray68")
|
|
1843 ((win default mono) . [default foreground]))
|
428
|
1844 'global)
|
|
1845 (set-face-foreground 'list-mode-item-selected
|
711
|
1846 '(((win default mono) . [default background]))
|
428
|
1847 'global)
|
|
1848
|
|
1849 (set-face-background 'primary-selection
|
711
|
1850 '(((win default color) . "gray65")
|
|
1851 ((win default grayscale) . "gray65"))
|
428
|
1852 'global)
|
|
1853 (set-face-background-pixmap 'primary-selection
|
711
|
1854 '(((win default mono) . "gray3"))
|
428
|
1855 'global)
|
|
1856
|
|
1857 (set-face-background 'secondary-selection
|
711
|
1858 '(((win default color) . "paleturquoise")
|
|
1859 ((win default color) . "green")
|
|
1860 ((win default grayscale) . "gray53"))
|
428
|
1861 'global)
|
|
1862 (set-face-background-pixmap 'secondary-selection
|
711
|
1863 '(((win default mono) . "gray1"))
|
428
|
1864 'global)
|
|
1865
|
|
1866 (set-face-background 'isearch
|
711
|
1867 '(((win default color) . "paleturquoise")
|
|
1868 ((win default color) . "green"))
|
428
|
1869 'global)
|
|
1870
|
|
1871 ;; #### This should really, I mean *really*, be converted to some form
|
|
1872 ;; of `defface' one day.
|
|
1873 (set-face-foreground 'isearch-secondary
|
711
|
1874 '(((win default color) . "red3"))
|
428
|
1875 'global)
|
|
1876
|
|
1877 ;; Define some logical color names to be used when reading the pixmap files.
|
|
1878 (if (featurep 'xpm)
|
|
1879 (setq xpm-color-symbols
|
|
1880 (list
|
444
|
1881 '("foreground" (face-foreground 'default))
|
|
1882 '("background" (face-background 'default))
|
|
1883 '("backgroundToolBarColor"
|
|
1884 (or
|
|
1885 (and
|
|
1886 (featurep 'x)
|
|
1887 (x-get-resource "backgroundToolBarColor"
|
|
1888 "BackgroundToolBarColor" 'string
|
|
1889 nil nil 'warn))
|
428
|
1890
|
444
|
1891 (face-background 'toolbar)))
|
|
1892 '("foregroundToolBarColor"
|
|
1893 (or
|
|
1894 (and
|
|
1895 (featurep 'x)
|
|
1896 (x-get-resource "foregroundToolBarColor"
|
|
1897 "ForegroundToolBarColor" 'string
|
|
1898 nil nil 'warn))
|
|
1899 (face-foreground 'toolbar)))
|
428
|
1900 )))
|
|
1901
|
|
1902 (when (featurep 'tty)
|
|
1903 (set-face-highlight-p 'bold t 'global '(default tty))
|
|
1904 (set-face-underline-p 'italic t 'global '(default tty))
|
|
1905 (set-face-highlight-p 'bold-italic t 'global '(default tty))
|
|
1906 (set-face-underline-p 'bold-italic t 'global '(default tty))
|
|
1907 (set-face-highlight-p 'highlight t 'global '(default tty))
|
|
1908 (set-face-reverse-p 'text-cursor t 'global '(default tty))
|
|
1909 (set-face-reverse-p 'modeline t 'global '(default tty))
|
|
1910 (set-face-reverse-p 'zmacs-region t 'global '(default tty))
|
|
1911 (set-face-reverse-p 'primary-selection t 'global '(default tty))
|
|
1912 (set-face-underline-p 'secondary-selection t 'global '(default tty))
|
|
1913 (set-face-reverse-p 'list-mode-item-selected t 'global '(default tty))
|
|
1914 (set-face-reverse-p 'isearch t 'global '(default tty))
|
|
1915 )
|
|
1916
|
|
1917 ;;; faces.el ends here
|