annotate lisp/prim/faces.el @ 123:c77884c6318d

Added tag r20-1b14 for changeset d2f30a177268
author cvs
date Mon, 13 Aug 2007 09:26:04 +0200
parents 7d55a9ba150c
children 6075d714658b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; faces.el --- Lisp interface to the C "face" structure
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995, 1996 Ben Wing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Author: Ben Wing <wing@666.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; Keywords: faces internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; face implementation #1 (used Lisp vectors and parallel C vectors;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; FSFmacs still uses this) authored by Jamie Zawinski <jwz@netscape.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; pre Lucid-Emacs 19.0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; face implementation #2 (used one face object per frame per face)
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
15 ;; authored by Jamie Zawinski for 19.9.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; face implementation #3 (use one face object per face) originally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; authored for 19.12 by Chuck Thompson <cthomp@cs.uiuc.edu>,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; rewritten by Ben Wing with the advent of specifiers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; You should have received a copy of the GNU General Public License
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 30
diff changeset
34 ;; along with XEmacs; see the file COPYING. If not, write to the
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 12
diff changeset
35 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 12
diff changeset
36 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;; Synched up with: Not synched with FSF. Almost completely divergent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;; Some stuff in FSF's faces.el is in our x-faces.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (defun read-face-name (prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (let (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (while (= (length face) 0) ; nil or ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (setq face (completing-read prompt
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
45 (mapcar (lambda (x) (list (symbol-name x)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (face-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (intern face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (defun face-interactive (what &optional bool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (let* ((fn (intern (concat "face-" what "-instance")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (face (read-face-name (format "Set %s of face: " what)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (default (if (fboundp fn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; #### we should distinguish here between
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; explicitly setting the value to be the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; same as the default face's value, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; not setting a value at all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (funcall fn face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (value (if bool
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (y-or-n-p (format "Should face %s be %s? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (symbol-name face) bool))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (read-string (format "Set %s of face %s to: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 what (symbol-name face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (cond ((font-instance-p default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (font-instance-name default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ((color-instance-p default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (color-instance-name default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ((image-instance-p default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (image-instance-file-name default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (t default))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (list face (if (equal value "") nil value))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (defconst built-in-face-specifiers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (built-in-face-specifiers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 "A list of the built-in face properties that are specifiers.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (defun face-property (face property &optional locale tag-set exact-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 "Return FACE's value of the given PROPERTY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 If LOCALE is omitted, the FACE's actual value for PROPERTY will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 returned. For built-in properties, this will be a specifier object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 of a type appropriate to the property (e.g. a font or color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 specifier). For other properties, this could be anything.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 If LOCALE is supplied, then instead of returning the actual value,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 the specification(s) for the given locale or locale type will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 be returned. This will only work if the actual value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 PROPERTY is a specifier (this will always be the case for built-in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 properties, but not or not may apply to user-defined properties).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 If the actual value of PROPERTY is not a specifier, this value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 will simply be returned regardless of LOCALE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 The return value will be a list of instantiators (e.g. strings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 specifying a font or color name), or a list of specifications, each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 of which is a cons of a locale and a list of instantiators.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 Specifically, if LOCALE is a particular locale (a buffer, window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 frame, device, or 'global), a list of instantiators for that locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 will be returned. Otherwise, if LOCALE is a locale type (one of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 the symbols 'buffer, 'window, 'frame, or 'device), the specifications
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 for all locales of that type will be returned. Finally, if LOCALE is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 'all, the specifications for all locales of all types will be returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 The specifications in a specifier determine what the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 PROPERTY will be in a particular \"domain\" or set of circumstances,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 which is typically a particular Emacs window along with the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 it contains and the frame and device it lies within. The value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 is derived from the instantiator associated with the most specific
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 locale (in the order buffer, window, frame, device, and 'global)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 that matches the domain in question. In other words, given a domain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (i.e. an Emacs window, usually), the specifier for PROPERTY will first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 be searched for a specification whose locale is the buffer contained
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 within that window; then for a specification whose locale is the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 itself; then for a specification whose locale is the frame that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 window is contained within; etc. The first instantiator that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 valid for the domain (usually this means that the instantiator is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 recognized by the device [i.e. the X server or TTY device] that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 domain is on. The function `face-property-instance' actually does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 all this, and is used to determine how to display the face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 See `set-face-property' for the built-in property-names."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
122 (setq face (get-face face))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (let ((value (get face property)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (if (and locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (or (memq property built-in-face-specifiers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (specifierp value)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (setq value (specifier-specs value locale tag-set exact-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (defun convert-face-property-into-specifier (face property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 "Convert PROPERTY on FACE into a specifier, if it's not already."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (setq face (get-face face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (let ((specifier (get face property)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ;; if a user-property does not have a specifier but a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;; locale was specified, put a specifier there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;; If there was already a value there, convert it to a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ;; specifier with the value as its 'global instantiator.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
138 (unless (specifierp specifier)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
139 (let ((new-specifier (make-specifier 'generic)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
140 (if (or (not (null specifier))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
141 ;; make sure the nil returned from `get' wasn't
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
142 ;; actually the value of the property
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
143 (null (get face property t)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
144 (add-spec-to-specifier new-specifier specifier))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
145 (setq specifier new-specifier)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
146 (put face property specifier)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (defun face-property-instance (face property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 &optional domain default no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 "Return the instance of FACE's PROPERTY in the specified DOMAIN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 Under most circumstances, DOMAIN will be a particular window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 and the returned instance describes how the specified property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 actually is displayed for that window and the particular buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 in it. Note that this may not be the same as how the property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 appears when the buffer is displayed in a different window or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 frame, or how the property appears in the same window if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 switch to another buffer in that window; and in those cases,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 the returned instance would be different.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 The returned instance will typically be a color-instance,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 font-instance, or pixmap-instance object, and you can query
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 it using the appropriate object-specific functions. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 you could use `color-instance-rgb-components' to find out the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 RGB (red, green, and blue) components of how the 'background
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 property of the 'highlight face is displayed in a particular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 window. The results might be different from the results
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 you would get for another window (perhaps the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 specified a different color for the frame that window is on;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 or perhaps the same color was specified but the window is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 on a different X server, and that X server has different RGB
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 values for the color from this one).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 DOMAIN defaults to the selected window if omitted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 DOMAIN can be a frame or device, instead of a window. The value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 returned for a such a domain is used in special circumstances
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 when a more specific domain does not apply; for example, a frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 value might be used for coloring a toolbar, which is conceptually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 attached to a frame rather than a particular window. The value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 is also useful in determining what the value would be for a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 particular window within the frame or device, if it is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 overridden by a more specific specification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 If PROPERTY does not name a built-in property, its value will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 simply be returned unless it is a specifier object, in which case
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 it will be instanced using `specifier-instance'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 Optional arguments DEFAULT and NO-FALLBACK are the same as in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 `specifier-instance'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
192 (setq face (get-face face))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (let ((value (get face property)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (if (specifierp value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (setq value (specifier-instance value domain default no-fallback)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (defun face-property-matching-instance (face property matchspec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 &optional domain default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 "Return the instance of FACE's PROPERTY matching MATCHSPEC in DOMAIN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 Currently the only useful value for MATCHSPEC is a charset, when used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 in conjunction with the face's font; this allows you to retrieve a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 font that can be used to display a particular charset, rather than just
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 any font.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 Other than MATCHSPEC, this function is identical to `face-property-instance'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 See also `specifier-matching-instance' for a fuller description of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 matching process."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
211 (setq face (get-face face))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (let ((value (get face property)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (if (specifierp value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (setq value (specifier-matching-instance value matchspec domain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 default no-fallback)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (defun set-face-property (face property value &optional locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 "Change a property of a FACE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 NOTE: If you want to remove a property from a face, use `remove-face-property'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 rather than attempting to set a value of nil for the property.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 For built-in properties, the actual value of the property is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 specifier and you cannot change this; but you can change the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 specifications within the specifier, and that is what this function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 will do. For user-defined properties, you can use this function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 to either change the actual value of the property or, if this value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 is a specifier, change the specifications within it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 If PROPERTY is a built-in property, the specifications to be added to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 this property can be supplied in many different ways:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 -- If VALUE is a simple instantiator (e.g. a string naming a font or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 color) or a list of instantiators, then the instantiator(s) will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 be added as a specification of the property for the given LOCALE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (which defaults to 'global if omitted).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 -- If VALUE is a list of specifications (each of which is a cons of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 a locale and a list of instantiators), then LOCALE must be nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (it does not make sense to explicitly specify a locale in this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 case), and specifications will be added as given.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 -- If VALUE is a specifier (as would be returned by `face-property'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 if no LOCALE argument is given), then some or all of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 specifications in the specifier will be added to the property.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 In this case, the function is really equivalent to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 `copy-specifier' and LOCALE has the same semantics (if it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 a particular locale, the specification for the locale will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 copied; if a locale type, specifications for all locales of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 that type will be copied; if nil or 'all, then all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 specifications will be copied).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 HOW-TO-ADD should be either nil or one of the symbols 'prepend,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 'append, 'remove-tag-set-prepend, 'remove-tag-set-append, 'remove-locale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 'remove-locale-type, or 'remove-all. See `copy-specifier' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 `add-spec-to-specifier' for a description of what each of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 these means. Most of the time, you do not need to worry about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 this argument; the default behavior usually is fine.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 In general, it is OK to pass an instance object (e.g. as returned
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 by `face-property-instance') as an instantiator in place of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 an actual instantiator. In such a case, the instantiator used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 to create that instance object will be used (for example, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 you set a font-instance object as the value of the 'font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 property, then the font name used to create that object will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 be used instead). If some cases, however, doing this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 conversion does not make sense, and this will be noted in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 the documentation for particular types of instance objects.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 If PROPERTY is not a built-in property, then this function will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 simply set its value if LOCALE is nil. However, if LOCALE is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 given, then this function will attempt to add VALUE as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 instantiator for the given LOCALE, using `add-spec-to-specifier'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 If the value of the property is not a specifier, it will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 automatically be converted into a 'generic specifier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 The following symbols have predefined meanings:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 foreground The foreground color of the face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 For valid instantiators, see `color-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 background The background color of the face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 For valid instantiators, see `color-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 font The font used to display text covered by this face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 For valid instantiators, see `font-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 display-table The display table of the face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 This should be a vector of 256 elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 background-pixmap The pixmap displayed in the background of the face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 Only used by faces on X devices.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 For valid instantiators, see `image-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 underline Underline all text covered by this face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 For valid instantiators, see `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 strikethru Draw a line through all text covered by this face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 For valid instantiators, see `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 highlight Highlight all text covered by this face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 Only used by faces on TTY devices.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 For valid instantiators, see `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 dim Dim all text covered by this face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 Only used by faces on TTY devices.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 For valid instantiators, see `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 blinking Blink all text covered by this face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 Only used by faces on TTY devices.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 For valid instantiators, see `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 reverse Reverse the foreground and background colors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 Only used by faces on TTY devices.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 For valid instantiators, see `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 doc-string Description of what the face's normal use is.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 NOTE: This is not a specifier, unlike all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 the other built-in properties, and cannot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 contain locale-specific values."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
323 (setq face (get-face face))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (if (memq property built-in-face-specifiers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (set-specifier (get face property) value locale tag-set how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 ;; This section adds user defined properties.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (if (not locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (put face property value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (convert-face-property-into-specifier face property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (add-spec-to-specifier (get face property) value locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 how-to-add)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (defun remove-face-property (face property &optional locale tag-set exact-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 "Remove a property from a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 For built-in properties, this is analogous to `remove-specifier'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 See `remove-specifier' for the meaning of the LOCALE, TAG-SET, and EXACT-P
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 arguments."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (or locale (setq locale 'all))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (if (memq property built-in-face-specifiers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (remove-specifier (face-property face property) locale tag-set exact-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (if (eq locale 'all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (remprop (get-face face) property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (convert-face-property-into-specifier face property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (remove-specifier (face-property face property) locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 exact-p))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (defun reset-face (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 "Clear all existing built-in specifications from FACE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 This makes FACE inherit all its display properties from 'default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 WARNING: Be absolutely sure you want to do this!!! It is a dangerous
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 operation and is not undoable."
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
354 (mapcar (lambda (x)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (remove-specifier (face-property face x)))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
356 built-in-face-specifiers)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (defun set-face-parent (face parent &optional locale tag-set how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 "Set the parent of FACE to PARENT, for all properties.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 This makes all properties of FACE inherit from PARENT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (setq parent (get-face parent))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
363 (mapcar (lambda (x)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (set-face-property face x (vector parent) locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 how-to-add))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
366 (delq 'display-table
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
367 (delq 'background-pixmap
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
368 (copy-sequence built-in-face-specifiers))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (set-face-background-pixmap face (vector 'inherit ':face parent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 locale tag-set how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (defun face-doc-string (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 "Return the documentation string for FACE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (face-property face 'doc-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (defun set-face-doc-string (face doc-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 "Change the documentation string of FACE to DOC-STRING."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (interactive (face-interactive "doc-string"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (set-face-property face 'doc-string doc-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (defun face-font-name (face &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 "Return the font name of the given face, or nil if it is unspecified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 DOMAIN is as in `face-font-instance'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (let ((f (face-font-instance face domain charset)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (and f (font-instance-name f))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (defun face-font (face &optional locale tag-set exact-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 "Return the font of the given face, or nil if it is unspecified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 LOCALE may be a locale (the instantiators for that particular locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 will be returned), a locale type (the specifications for all locales
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 of that type will be returned), 'all (all specifications will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 returned), or nil (the actual specifier object will be returned).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 See `face-property' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (face-property face 'font locale tag-set exact-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (defun face-font-instance (face &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 "Return the instance of the given face's font in the given domain.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 Normally DOMAIN will be a window or nil (meaning the selected window),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 and an instance object describing how the font appears in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 particular window and buffer will be returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 See `face-property-instance' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (if charset
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (face-property-matching-instance face 'font charset domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (face-property-instance face 'font domain)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (defun set-face-font (face font &optional locale tag-set how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 "Change the font of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 FONT should be an instantiator (see `font-specifier-p'), a list of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 instantiators, an alist of specifications (each mapping a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 locale to an instantiator list), or a font specifier object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 If FONT is an alist, LOCALE must be omitted. If FONT is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 specifier object, LOCALE can be a locale, a locale type, 'all,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 specifies the locale under which the specified instantiator(s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 will be added, and defaults to 'global.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 See `set-face-property' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (interactive (face-interactive "font"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (set-face-property face 'font font locale tag-set how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (defun face-foreground (face &optional locale tag-set exact-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 "Return the foreground of the given face, or nil if it is unspecified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 LOCALE may be a locale (the instantiators for that particular locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 will be returned), a locale type (the specifications for all locales
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 of that type will be returned), 'all (all specifications will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 returned), or nil (the actual specifier object will be returned).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 See `face-property' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (face-property face 'foreground locale tag-set exact-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (defun face-foreground-instance (face &optional domain default no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 "Return the instance of the given face's foreground in the given domain.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 Normally DOMAIN will be a window or nil (meaning the selected window),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 and an instance object describing how the foreground appears in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 particular window and buffer will be returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 See `face-property-instance' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (face-property-instance face 'foreground domain default no-fallback))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (defun set-face-foreground (face color &optional locale tag-set how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 "Change the foreground of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 COLOR should be an instantiator (see `color-specifier-p'), a list of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 instantiators, an alist of specifications (each mapping a locale to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 an instantiator list), or a color specifier object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 If COLOR is an alist, LOCALE must be omitted. If COLOR is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 specifier object, LOCALE can be a locale, a locale type, 'all,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 specifies the locale under which the specified instantiator(s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 will be added, and defaults to 'global.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 See `set-face-property' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (interactive (face-interactive "foreground"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (set-face-property face 'foreground color locale tag-set how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (defun face-background (face &optional locale tag-set exact-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 "Return the background of the given face, or nil if it is unspecified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 LOCALE may be a locale (the instantiators for that particular locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 will be returned), a locale type (the specifications for all locales
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 of that type will be returned), 'all (all specifications will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 returned), or nil (the actual specifier object will be returned).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 See `face-property' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (face-property face 'background locale tag-set exact-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (defun face-background-instance (face &optional domain default no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 "Return the instance of the given face's background in the given domain.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 Normally DOMAIN will be a window or nil (meaning the selected window),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 and an instance object describing how the background appears in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 particular window and buffer will be returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 See `face-property-instance' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (face-property-instance face 'background domain default no-fallback))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (defun set-face-background (face color &optional locale tag-set how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 "Change the background of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 COLOR should be an instantiator (see `color-specifier-p'), a list of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 instantiators, an alist of specifications (each mapping a locale to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 an instantiator list), or a color specifier object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 If COLOR is an alist, LOCALE must be omitted. If COLOR is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 specifier object, LOCALE can be a locale, a locale type, 'all,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 specifies the locale under which the specified instantiator(s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 will be added, and defaults to 'global.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 See `set-face-property' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (interactive (face-interactive "background"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (set-face-property face 'background color locale tag-set how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (defun face-background-pixmap (face &optional locale tag-set exact-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 "Return the background pixmap of the given face, or nil if it is unspecified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 This property is only used on X devices.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 LOCALE may be a locale (the instantiators for that particular locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 will be returned), a locale type (the specifications for all locales
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 of that type will be returned), 'all (all specifications will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 returned), or nil (the actual specifier object will be returned).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 See `face-property' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (face-property face 'background-pixmap locale tag-set exact-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (defun face-background-pixmap-instance (face &optional domain default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 "Return the instance of the given face's background pixmap in the given domain.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 Normally DOMAIN will be a window or nil (meaning the selected window),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 and an instance object describing how the background appears in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 particular window and buffer will be returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 See `face-property-instance' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (face-property-instance face 'background-pixmap domain default no-fallback))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (defun set-face-background-pixmap (face pixmap &optional locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 "Change the background pixmap of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 This property is only used on X devices.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 FACE may be either a face object or a symbol representing a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 PIXMAP should be an instantiator (see `image-specifier-p'), a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 of instantiators, an alist of specifications (each mapping a locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 to an instantiator list), or an image specifier object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 If PIXMAP is an alist, LOCALE must be omitted. If PIXMAP is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 specifier object, LOCALE can be a locale, a locale type, 'all,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 specifies the locale under which the specified instantiator(s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 will be added, and defaults to 'global.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 See `set-face-property' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (interactive (face-interactive "background-pixmap"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (set-face-property face 'background-pixmap pixmap locale tag-set how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (defun face-display-table (face &optional locale tag-set exact-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 "Return the display table of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 A vector (as returned by `make-display-table') will be returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 LOCALE may be a locale (the instantiators for that particular locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 will be returned), a locale type (the specifications for all locales
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 of that type will be returned), 'all (all specifications will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 returned), or nil (the actual specifier object will be returned).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 See `face-property' for more information."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (face-property face 'display-table locale tag-set exact-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (defun face-display-table-instance (face &optional domain default no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 "Return the instance of FACE's display table in DOMAIN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 A vector (as returned by `make-display-table') will be returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (face-property-instance face 'display-table domain default no-fallback))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (defun set-face-display-table (face display-table &optional locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 "Change the display table of the given face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 DISPLAY-TABLE should be a vector as returned by `make-display-table'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 HOW-TO-ADD arguments."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (interactive (face-interactive "display-table"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (set-face-property face 'display-table display-table locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (defun face-underline-p (face &optional domain default no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 "Return whether the given face is underlined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (face-property-instance face 'underline domain default no-fallback))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (defun set-face-underline-p (face underline-p &optional locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 "Change whether the given face is underlined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 UNDERLINE-P is normally a face-boolean instantiator; see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 HOW-TO-ADD arguments."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (interactive (face-interactive "underline-p" "underlined"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (set-face-property face 'underline underline-p locale tag-set how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (defun face-strikethru-p (face &optional domain default no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 "Return whether the given face is strikethru-d (i.e. struck through).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (face-property-instance face 'strikethru domain default no-fallback))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (defun set-face-strikethru-p (face strikethru-p &optional locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 "Change whether the given face is strikethru-d (i.e. struck through).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 STRIKETHRU-P is normally a face-boolean instantiator; see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 HOW-TO-ADD arguments."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (interactive (face-interactive "strikethru-p" "strikethru-d"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (set-face-property face 'strikethru strikethru-p locale tag-set how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (defun face-highlight-p (face &optional domain default no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 "Return whether the given face is highlighted (TTY domains only).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (face-property-instance face 'highlight domain default no-fallback))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (defun set-face-highlight-p (face highlight-p &optional locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 "Change whether the given face is highlighted (TTY locales only).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 HIGHLIGHT-P is normally a face-boolean instantiator; see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 HOW-TO-ADD arguments."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (interactive (face-interactive "highlight-p" "highlighted"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (set-face-property face 'highlight highlight-p locale tag-set how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (defun face-dim-p (face &optional domain default no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 "Return whether the given face is dimmed (TTY domains only).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (face-property-instance face 'dim domain default no-fallback))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (defun set-face-dim-p (face dim-p &optional locale tag-set how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 "Change whether the given face is dimmed (TTY locales only).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 DIM-P is normally a face-boolean instantiator; see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 HOW-TO-ADD arguments."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (interactive (face-interactive "dim-p" "dimmed"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (set-face-property face 'dim dim-p locale tag-set how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (defun face-blinking-p (face &optional domain default no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 "Return whether the given face is blinking (TTY domains only).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (face-property-instance face 'blinking domain default no-fallback))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (defun set-face-blinking-p (face blinking-p &optional locale tag-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 "Change whether the given face is blinking (TTY locales only).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 BLINKING-P is normally a face-boolean instantiator; see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 HOW-TO-ADD arguments."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (interactive (face-interactive "blinking-p" "blinking"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (set-face-property face 'blinking blinking-p locale tag-set how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (defun face-reverse-p (face &optional domain default no-fallback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 "Return whether the given face is reversed (TTY domains only).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (face-property-instance face 'reverse domain default no-fallback))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (defun set-face-reverse-p (face reverse-p &optional locale tag-set how-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 "Change whether the given face is reversed (TTY locales only).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 REVERSE-P is normally a face-boolean instantiator; see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 `face-boolean-specifier-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 HOW-TO-ADD arguments."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (interactive (face-interactive "reverse-p" "reversed"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (set-face-property face 'reverse reverse-p locale tag-set how-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (defun face-property-equal (face1 face2 prop domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (equal (face-property-instance face1 prop domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (face-property-instance face2 prop domain)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (defun face-equal-loop (props face1 face2 domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (while (and props
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (face-property-equal face1 face2 (car props) domain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (setq props (cdr props)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (null props))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (defun face-equal (face1 face2 &optional domain)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
701 "True if the given faces will display in the same way.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (if (null domain) (setq domain (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (if (not (valid-specifier-domain-p domain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (error "Invalid specifier domain"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (let ((device (dfw-device domain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 (common-props '(foreground background font display-table underline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (x-props '(background-pixmap strikethru))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (tty-props '(highlight dim blinking reverse)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 ;; First check the properties which are used in common between the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 ;; x and tty devices. Then, check those properties specific to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 ;; the particular device type.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (and (face-equal-loop common-props face1 face2 domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (cond ((eq 'tty (device-type device))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (face-equal-loop tty-props face1 face2 domain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 ((eq 'x (device-type device))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (face-equal-loop x-props face1 face2 domain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (t t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (defun face-differs-from-default-p (face &optional domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 "True if the given face will display differently from the default face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (not (face-equal face 'default domain)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 ;; This function is a terrible, disgusting hack!!!! Need to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 ;; separate out the font elements as separate face properties!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 ;; WE DEMAND LEXICAL SCOPING!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (defun frob-face-property (face property func &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 "Change the specifier for FACE's PROPERTY according to FUNC, in LOCALE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 This function is ugly and messy and is primarily used as an internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 helper function for `make-face-bold' et al., so you probably don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 want to use it or read the rest of the documentation. But if you do ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 FUNC should be a function of two arguments (an instance and a device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 that returns a modified name that is valid for the given device.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 If LOCALE specifies a valid domain (i.e. a window, frame, or device),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 this function instantiates the specifier over that domain, applies FUNC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 to the resulting instance, and adds the result back as an instantiator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 for that locale. Otherwise, LOCALE should be a locale, locale type, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 'all (defaults to 'all if omitted). For each specification thusly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 included: if the locale given is a valid domain, FUNC will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 iterated over all valid instantiators for the device of the domain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 until a non-nil result is found (if there is no such result, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 first valid instantiator is used), and that result substituted for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 the specification; otherwise, the process just outlined is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 iterated over each existing device and the concatenated results
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 substituted for the specification."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (let ((sp (face-property face property)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (if (valid-specifier-domain-p locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 ;; this is easy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (let* ((inst (face-property-instance face property locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (name (and inst (funcall func inst (dfw-device locale)))))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
770 (when name
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
771 (add-spec-to-specifier sp name locale)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 ;; otherwise, map over all specifications ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 ;; but first, some further kludging:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 ;; (1) if we're frobbing the global property, make sure
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 ;; that something is there (copy from the default face,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 ;; if necessary). Otherwise, something like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 ;; (make-face-larger 'modeline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 ;; won't do anything at all if the modeline simply
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 ;; inherits its font from 'default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 ;; (2) if we're frobbing a particular locale, nothing would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 ;; happen if that locale has no instantiators. So signal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 ;; an error to indicate this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (if (and (or (eq locale 'global) (eq locale 'all) (not locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (not (face-property face property 'global)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (copy-specifier (face-property 'default property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (face-property face property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 'global))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (if (and (valid-specifier-locale-p locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (not (face-property face property locale)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (error "Property must have a specification in locale %S" locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (map-specifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 sp
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
793 (lambda (sp locale inst-list func)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
794 (let* ((device (dfw-device locale))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
795 ;; if a device can be derived from the locale,
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
796 ;; call frob-face-property-1 for that device.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
797 ;; Otherwise map frob-face-property-1 over each device.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
798 (result
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
799 (if device
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
800 (list (frob-face-property-1 sp device inst-list func))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
801 (mapcar (lambda (device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
802 (frob-face-property-1 sp device
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
803 inst-list func))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
804 (device-list))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
805 new-result)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
806 ;; remove duplicates and nils from the obtained list of
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
807 ;; instantiators.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
808 (mapcar (lambda (arg)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
809 (when (and arg (not (member arg new-result)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
810 (setq new-result (cons arg new-result))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
811 result)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
812 ;; add back in.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
813 (add-spec-list-to-specifier sp (list (cons locale new-result)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
814 ;; tell map-specifier to keep going.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
815 nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 func))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (defun frob-face-property-1 (sp device inst-list func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 (let
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (first-valid result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (while (and inst-list (not result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (let* ((inst-pair (car inst-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (tag-set (car inst-pair))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (sp-inst (specifier-instance-from-inst-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 sp device (list inst-pair))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (if sp-inst
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 (if (not first-valid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (setq first-valid inst-pair))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 (setq result (funcall func sp-inst device))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (if result
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 (setq result (cons tag-set result))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 (setq inst-list (cdr inst-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (or result first-valid)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (defun frob-face-font-2 (face locale unfrobbed-face frobbed-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 tty-thunk x-thunk standard-face-mapping)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 ;; another kludge to make things more intuitive. If we're
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 ;; inheriting from a standard face in this locale, frob the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 ;; inheritance as appropriate. Else, if, after the first X frobbing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 ;; pass, the face hasn't changed and still looks like the standard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 ;; unfrobbed face (e.g. 'default), make it inherit from the standard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 ;; frobbed face (e.g. 'bold). Regardless of things, do the TTY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 ;; frobbing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 ;; yuck -- The LOCALE argument to make-face-bold is not actually a locale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 ;; but is a "locale, locale-type, or nil for all". So ... do our extra
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 ;; frobbing only if it's actually a locale; or for nil, do the frobbing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 ;; on 'global. This specifier stuff needs some rethinking.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (let* ((the-locale (cond ((null locale) 'global)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 ((valid-specifier-locale-p locale) locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (specs (and the-locale (face-font face the-locale nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 (change-it (and specs (cdr (assoc specs standard-face-mapping)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (if (and change-it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (not (memq (face-name (find-face face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 '(default bold italic bold-italic))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (or (equal change-it t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (set-face-property face 'font change-it the-locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (funcall tty-thunk))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (let* ((domain (cond ((null the-locale) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 ((valid-specifier-domain-p the-locale) the-locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 ;; OK, this next one is truly a kludge, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 ;; it results in more intuitive behavior most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 ;; of the time. (really!)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 ((or (eq the-locale 'global) (eq the-locale 'all))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (selected-device))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (inst (and domain (face-property-instance face 'font domain))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (funcall tty-thunk)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (funcall x-thunk)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 ;; If it's reasonable to do the inherit-from-standard-face trick,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 ;; and it's called for, then do it now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (or (null domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (not (equal inst (face-property-instance face 'font domain)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 ;; don't do it for standard faces, or you'll get inheritance loops.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 ;; #### This makes XEmacs seg fault! fix this bug.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (memq (face-name (find-face face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 '(default bold italic bold-italic))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (not (equal (face-property-instance face 'font domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 (face-property-instance unfrobbed-face 'font domain)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (set-face-property face 'font (vector frobbed-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 the-locale))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (defun make-face-bold (face &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 "Make the face bold, if possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 This will attempt to make the font bold for X locales and will set the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 highlight flag for TTY locales.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 If LOCALE is nil, omitted, or `all', this will attempt to frob all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 font specifications for FACE to make them appear bold. Similarly, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 LOCALE is a locale type, this frobs all font specifications for locales
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 of that type. If LOCALE is a particular locale, what happens depends on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 what sort of locale is given. If you gave a device, frame, or window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 then it's always possible to determine what the font actually will be,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 so this is determined and the resulting font is frobbed and added back as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 specification for this locale. If LOCALE is a buffer, however, you can't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 determine what the font will actually be unless there's actually a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 specification given for that particular buffer (otherwise, it depends
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 on what window and frame the buffer appears in, and might not even be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 well-defined if the buffer appears multiple times in different places);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 therefore you will get an error unless there's a specification for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 Finally, in some cases (specifically, when LOCALE is not a locale type),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 if the frobbing didn't actually make the font look any different
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 \(this happens, for example, if your font specification is already bold
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 or has no bold equivalent), and currently looks like the font of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 'default face, it is set to inherit from the 'bold face. This is kludgy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 but it makes `make-face-bold' have more intuitive behavior in many
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 circumstances."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (interactive (list (read-face-name "Make which face bold: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (frob-face-font-2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 face locale 'default 'bold
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
917 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
918 ;; handle TTY specific entries
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
919 (when (featurep 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
920 (set-face-highlight-p face t locale 'tty)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
921 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
922 ;; handle X specific entries
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
923 (frob-face-property face 'font 'x-make-font-bold locale))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 '(([default] . [bold])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 ([bold] . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 ([italic] . [bold-italic])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 ([bold-italic] . t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (defun make-face-italic (face &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 "Make the face italic, if possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 This will attempt to make the font italic for X locales and will set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 the underline flag for TTY locales.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 See `make-face-bold' for the semantics of the LOCALE argument and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 for more specifics on exactly how this function works."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (interactive (list (read-face-name "Make which face italic: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (frob-face-font-2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 face locale 'default 'italic
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
938 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
939 ;; handle TTY specific entries
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
940 (when (featurep 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
941 (set-face-underline-p face t locale 'tty)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
942 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
943 ;; handle X specific entries
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
944 (frob-face-property face 'font 'x-make-font-italic locale))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 '(([default] . [italic])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 ([bold] . [bold-italic])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 ([italic] . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 ([bold-italic] . t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (defun make-face-bold-italic (face &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 "Make the face bold and italic, if possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 This will attempt to make the font bold-italic for X locales and will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 set the highlight and underline flags for TTY locales.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 See `make-face-bold' for the semantics of the LOCALE argument and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 for more specifics on exactly how this function works."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (interactive (list (read-face-name "Make which face bold-italic: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (frob-face-font-2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 face locale 'default 'bold-italic
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
959 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
960 ;; handle TTY specific entries
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
961 (when (featurep 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
962 (set-face-highlight-p face t locale 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
963 (set-face-underline-p face t locale 'tty)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
964 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
965 ;; handle X specific entries
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
966 (frob-face-property face 'font 'x-make-font-bold-italic locale))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 '(([default] . [italic])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 ([bold] . [bold-italic])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 ([italic] . [bold-italic])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 ([bold-italic] . t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (defun make-face-unbold (face &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 "Make the face non-bold, if possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 This will attempt to make the font non-bold for X locales and will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 unset the highlight flag for TTY locales.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 See `make-face-bold' for the semantics of the LOCALE argument and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 for more specifics on exactly how this function works."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (interactive (list (read-face-name "Make which face non-bold: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (frob-face-font-2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 face locale 'bold 'default
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
981 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
982 ;; handle TTY specific entries
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
983 (when (featurep 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
984 (set-face-highlight-p face nil locale 'tty)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
985 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
986 ;; handle X specific entries
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
987 (frob-face-property face 'font 'x-make-font-unbold locale))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 '(([default] . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 ([bold] . [default])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 ([italic] . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 ([bold-italic] . [italic]))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (defun make-face-unitalic (face &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 "Make the face non-italic, if possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 This will attempt to make the font non-italic for X locales and will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 unset the underline flag for TTY locales.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 See `make-face-bold' for the semantics of the LOCALE argument and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 for more specifics on exactly how this function works."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (interactive (list (read-face-name "Make which face non-italic: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (frob-face-font-2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 face locale 'italic 'default
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1002 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1003 ;; handle TTY specific entries
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1004 (when (featurep 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1005 (set-face-underline-p face nil locale 'tty)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1006 (lambda ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1007 ;; handle X specific entries
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1008 (frob-face-property face 'font 'x-make-font-unitalic locale))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 '(([default] . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 ([bold] . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 ([italic] . [default])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 ([bold-italic] . [bold]))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (defun make-face-smaller (face &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 "Make the font of the given face be smaller, if possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 LOCALE works as in `make-face-bold' et al., but the ``inheriting-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 from-the-bold-face'' operations described there are not done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 because they don't make sense in this context."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (interactive (list (read-face-name "Shrink which face: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 ;; handle X specific entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (frob-face-property face 'font 'x-find-smaller-font locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (defun make-face-larger (face &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 "Make the font of the given face be larger, if possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 See `make-face-smaller' for the semantics of the LOCALE argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (interactive (list (read-face-name "Enlarge which face: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 ;; handle X specific entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (frob-face-property face 'font 'x-find-larger-font locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (defun invert-face (face &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 "Swap the foreground and background colors of the face."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (if (valid-specifier-domain-p locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (let ((foreface (face-foreground-instance face locale)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (set-face-foreground face (face-background-instance face locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (set-face-background face foreface locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (let ((forespec (copy-specifier (face-foreground face) nil locale)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 (copy-specifier (face-background face) (face-foreground face) locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (copy-specifier forespec (face-background face) locale))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 ;;; Convenience functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (defun face-ascent (face &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 "Return the ascent of a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (font-ascent (face-font face) domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (defun face-descent (face &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 "Return the descent of a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (font-descent (face-font face) domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (defun face-width (face &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 "Return the width of a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (font-width (face-font face) domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 (defun face-height (face &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 "Return the height of a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (+ (face-ascent face domain charset) (face-descent face domain charset)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (defun face-proportional-p (face &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 "Return whether FACE is proportional.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 See `face-property-instance' for the semantics of the DOMAIN argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (font-proportional-p (face-font face) domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069
106
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1070 (defvar init-face-from-resources t
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 106
diff changeset
1071 "If non-nil, attempt to initialize faces from the resource database.")
106
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1072
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1073 (defun make-empty-face (name &optional doc-string temporary)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 106
diff changeset
1074 "Like `make-face', but doesn't query the resource database."
106
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1075 (let ((init-face-from-resources nil))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1076 (make-face name doc-string temporary)))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1077
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (defun init-face-from-resources (face &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 "Initialize FACE from the resource database.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 If LOCALE is specified, it should be a frame, device, or 'global, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 the face will be resourced over that locale. Otherwise, the face will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 be resourced over all possible locales (i.e. all frames, all devices,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 and 'global)."
106
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1084 (cond ((null init-face-from-resources)
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1085 ;; Do nothing.
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1086 )
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1087 ((not locale)
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1088 ;; Global, set for all frames.
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1089 (progn
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1090 (init-face-from-resources face 'global)
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1091 (let ((devices (device-list)))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1092 (while devices
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1093 (init-face-from-resources face (car devices))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1094 (setq devices (cdr devices))))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1095 (let ((frames (frame-list)))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1096 (while frames
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1097 (init-face-from-resources face (car frames))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1098 (setq frames (cdr frames))))))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1099 (t
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1100 ;; Specific.
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1101 (let ((devtype (cond ((devicep locale) (device-type locale))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1102 ((framep locale) (frame-type locale))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1103 (t nil))))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1104 (cond ((or (and (not devtype) (featurep 'x)) (eq 'x devtype))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1105 (x-init-face-from-resources face locale))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1106 ((or (not devtype) (eq 'tty devtype))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1107 ;; Nothing to do for TTYs?
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1108 ))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (defun init-device-faces (device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 ;; First, add any device-local face resources.
106
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1112 (when init-face-from-resources
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1113 (loop for face in (face-list) do
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1114 (init-face-from-resources face device))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1115 ;; Then do any device-specific initialization.
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1116 (cond ((eq 'x (device-type device))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1117 (x-init-device-faces device))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1118 ;; Nothing to do for TTYs?
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1119 )
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1120 (init-other-random-faces device)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 (defun init-frame-faces (frame)
106
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1123 (when init-face-from-resources
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1124 ;; First, add any frame-local face resources.
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1125 (loop for face in (face-list) do
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1126 (init-face-from-resources face frame))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1127 ;; Then do any frame-specific initialization.
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1128 (cond ((eq 'x (frame-type frame))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1129 (x-init-frame-faces frame))
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1130 ;; Is there anything which should be done for TTY's?
8ff55ebd4be9 Import from CVS: tag r20-1b5
cvs
parents: 104
diff changeset
1131 )))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 ;; #### This is somewhat X-specific, and is called when the first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 ;; X device is created (even if there were TTY devices created
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 ;; beforehand). The concept of resources has not been generalized
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 ;; outside of X-specificness, so we have to live with this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 ;; breach of device-independence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (defun init-global-faces ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 ;; Look for global face resources.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1141 (loop for face in (face-list) do
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1142 (init-face-from-resources face 'global))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 ;; Further X frobbing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (x-init-global-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 ;; for bold and the like, make the global specification be bold etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 ;; if the user didn't already specify a value. These will also be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 ;; frobbed further in init-other-random-faces.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1148 (unless (face-font 'bold 'global)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1149 (make-face-bold 'bold 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1150 ;;
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1151 (unless (face-font 'italic 'global)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1152 (make-face-italic 'italic 'global))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 ;;
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1154 (unless (face-font 'bold-italic 'global)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1155 (make-face-bold-italic 'bold-italic 'global)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1156 (unless (face-font 'bold-italic 'global)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1157 (copy-face 'bold 'bold-italic)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1158 (make-face-italic 'bold-italic)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1160 (when (face-equal 'bold 'bold-italic)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1161 (copy-face 'italic 'bold-italic)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1162 (make-face-bold 'bold-italic))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 ;; Nothing more to be done for X or TTY's?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 ;; These warnings are there for a reason.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 ;; Just specify your fonts correctly. Deal with it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 ;(defvar inhibit-font-complaints nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 ; "Whether to suppress complaints about incomplete sets of fonts.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 (defun face-complain-about-font (face device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 (if (symbolp face) (setq face (symbol-name face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 ;; (if (not inhibit-font-complaints)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1176 (display-warning
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1177 'font
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1178 (let ((default-name (face-font-name 'default device)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1179 (format "%s: couldn't deduce %s %s version of the font
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1180 %S.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1181
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1182 Please specify X resources to make the %s face
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1183 visually distinguishable from the default face.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1184 For example, you could add one of the following to $HOME/Emacs:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1185
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1186 Emacs.%s.attributeFont: -dt-*-medium-i-*
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1187 or
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1188 Emacs.%s.attributeForeground: hotpink\n"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1189 invocation-name
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1190 (if (string-match "\\`[aeiouAEIOU]" face) "an" "a")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1191 face
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1192 default-name
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1193 face
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1194 face
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1195 face
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1196 ))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 (defun init-other-random-faces (device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 "Initializes the colors and fonts of the bold, italic, bold-italic,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 zmacs-region, list-mode-item-selected, highlight, primary-selection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 secondary-selection, and isearch faces when each device is created. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 you want to add code to do stuff like this, use the create-device-hook."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 ;; try to make 'bold look different from the default on this device.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 ;; If that doesn't work at all, then issue a warning.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1206 (unless (face-differs-from-default-p 'bold device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1207 (make-face-bold 'bold device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1208 (unless (face-differs-from-default-p 'bold device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1209 (make-face-unbold 'bold device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1210 (unless (face-differs-from-default-p 'bold device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1211 ;; the luser specified one of the bogus font names
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1212 (face-complain-about-font 'bold device))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1214 ;; Similar for italic.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1215 ;; It's unreasonable to expect to be able to make a font italic all
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1216 ;; the time. For many languages, italic is an alien concept.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1217 ;; Basically, because italic is not a globally meaningful concept,
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1218 ;; the use of the italic face should really be oboleted.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1219
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1220 ;; In a Solaris Japanese environment, there just aren't any italic
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1221 ;; fonts - period. CDE recognizes this reality, and fonts
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1222 ;; -dt-interface user-medium-r-normal-*-*-*-*-*-*-*-*-* don't come
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1223 ;; in italic versions. So we first try to make the font bold before
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1224 ;; complaining.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1225 (unless (face-differs-from-default-p 'italic device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1226 (make-face-italic 'italic device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1227 (unless (face-differs-from-default-p 'italic device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1228 (make-face-bold 'italic device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1229 (unless (face-differs-from-default-p 'italic device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1230 (face-complain-about-font 'italic device))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 ;; similar for bold-italic.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1233 (unless (face-differs-from-default-p 'bold-italic device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1234 (make-face-bold-italic 'bold-italic device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1235 ;; if we couldn't get a bold-italic version, try just bold.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1236 (unless (face-differs-from-default-p 'bold-italic device)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 106
diff changeset
1237 (make-face-bold 'bold-italic device)
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1238 ;; if we couldn't get bold or bold-italic, then that's probably because
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1239 ;; the default font is bold, so make the `bold-italic' face be unbold.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1240 (unless (face-differs-from-default-p 'bold-italic device)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 (make-face-unbold 'bold-italic device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 (make-face-italic 'bold-italic device)
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1243 (unless (face-differs-from-default-p 'bold-italic device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1244 ;; if that didn't work, try plain italic
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1245 ;; (can this ever happen? what the hell.)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1246 (make-face-italic 'bold-italic device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1247 (unless (face-differs-from-default-p 'bold-italic device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1248 ;; then bitch and moan.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1249 (face-complain-about-font 'bold-italic device))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1251 ;; Set the text-cursor colors unless already specified.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1252 (when (and (not (face-background 'text-cursor 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1253 (face-property-equal 'text-cursor 'default 'background device))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1254 (set-face-background 'text-cursor [default foreground] 'global
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1255 nil 'append))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1256 (when (and (not (face-foreground 'text-cursor 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1257 (face-property-equal 'text-cursor 'default 'foreground device))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1258 (set-face-foreground 'text-cursor [default background] 'global
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1259 nil 'append))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1261 ;; Set the secondary-selection color unless already specified.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1262 (unless (or (face-differs-from-default-p 'highlight device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1263 (face-background 'highlight 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1264 ;; some older servers don't recognize "darkseagreen2"
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1265 (set-face-background 'highlight
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1266 '((color . "darkseagreen2")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1267 (color . "green"))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1268 'global nil 'append)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1269 (set-face-background 'highlight "gray53" 'global 'grayscale 'append))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1270 (unless (or (face-differs-from-default-p 'highlight device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1271 (face-background-pixmap 'highlight 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1272 (set-face-background-pixmap 'highlight [nothing] 'global 'color 'append)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1273 (set-face-background-pixmap 'highlight [nothing] 'global 'grayscale 'append)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1274 (set-face-background-pixmap 'highlight "gray1" 'global 'mono 'append))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 ;; if the highlight face isn't distinguished on this device,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 ;; at least try inverting it.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1277 (unless (face-differs-from-default-p 'highlight device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1278 (invert-face 'highlight device))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 ;; first time through, set the zmacs-region color if it's not already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 ;; specified.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1282 (unless (or (face-differs-from-default-p 'zmacs-region device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1283 (face-background 'zmacs-region 'global))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1284 (set-face-background 'zmacs-region "gray65" 'global 'color)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1285 (set-face-background 'zmacs-region "gray65" 'global 'grayscale))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1286 (unless (or (face-differs-from-default-p 'zmacs-region device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1287 (face-background-pixmap 'zmacs-region 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1288 (set-face-background-pixmap 'zmacs-region [nothing] 'global 'color)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1289 (set-face-background-pixmap 'zmacs-region [nothing] 'global 'grayscale)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1290 (set-face-background-pixmap 'zmacs-region "gray3" 'global 'mono))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 ;; if the zmacs-region face isn't distinguished on this device,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 ;; at least try inverting it.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1293 (unless (face-differs-from-default-p 'zmacs-region device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1294 (invert-face 'zmacs-region device))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 ;; first time through, set the list-mode-item-selected color if it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 ;; not already specified.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1298 (unless (or (face-differs-from-default-p 'list-mode-item-selected device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1299 (face-background 'list-mode-item-selected 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1300 (set-face-background 'list-mode-item-selected "gray68" 'global 'color)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1301 (set-face-background 'list-mode-item-selected "gray68" 'global 'grayscale)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1302 (unless (face-foreground 'list-mode-item-selected 'global)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1303 (set-face-background 'list-mode-item-selected
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1304 [default foreground] 'global '(mono x))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1305 (set-face-foreground 'list-mode-item-selected
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1306 [default background] 'global '(mono x))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 ;; if the list-mode-item-selected face isn't distinguished on this device,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 ;; at least try inverting it.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1309 (unless (face-differs-from-default-p 'list-mode-item-selected device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1310 (invert-face 'list-mode-item-selected device))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1312 ;; Set the primary-selection color unless already specified.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1313 (unless (or (face-differs-from-default-p 'primary-selection device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1314 (face-background 'primary-selection 'global))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1315 (set-face-background 'primary-selection "gray65" 'global 'color)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1316 (set-face-background 'primary-selection "gray65" 'global 'grayscale))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1317 (unless (or (face-differs-from-default-p 'secondary-selection device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1318 (face-background-pixmap 'primary-selection 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1319 (set-face-background-pixmap 'primary-selection "gray3" 'global 'mono))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1320 ;; If the primary-selection face isn't distinguished on this device,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 ;; at least try inverting it.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1322 (unless (face-differs-from-default-p 'primary-selection device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1323 (invert-face 'primary-selection device))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1325 ;; Set the secondary-selection color unless already specified.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1326 (unless (or (face-differs-from-default-p 'secondary-selection device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1327 (face-background 'secondary-selection 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1328 (set-face-background 'secondary-selection
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1329 '((color . "paleturquoise")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1330 (color . "green"))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1331 'global)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1332 (set-face-background 'secondary-selection "gray53" 'global
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1333 'grayscale))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1334 (unless (or (face-differs-from-default-p 'secondary-selection device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1335 (face-background-pixmap 'secondary-selection 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1336 (set-face-background-pixmap 'secondary-selection "gray1" 'global 'mono))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1337 ;; If the secondary-selection face isn't distinguished on this device,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 ;; at least try inverting it.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1339 (unless (face-differs-from-default-p 'secondary-selection device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1340 (invert-face 'secondary-selection device))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1342 ;; Set the isearch color if unless already specified.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1343 (unless (or (face-differs-from-default-p 'isearch device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1344 (face-background 'isearch 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1345 ;; TTY's and some older X servers don't recognize "paleturquoise"
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1346 (set-face-background 'isearch
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1347 '((color . "paleturquoise")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1348 (color . "green"))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1349 'global))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 ;; if the isearch face isn't distinguished (e.g. we're not on a color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 ;; display), at least try making it bold.
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1352 (unless (face-differs-from-default-p 'isearch device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1353 (set-face-font 'isearch [bold]))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1355 ;; Set the modeline face colors/fonts unless already specified.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 ;; modeline-buffer-id:
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1358 (unless (face-differs-from-default-p 'modeline-buffer-id device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1359 (let ((fg (face-foreground 'modeline-buffer-id 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1360 (font (face-font 'modeline-buffer-id 'global)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1361 (when (and (null fg) (featurep 'x))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 86
diff changeset
1362 (set-face-foreground 'modeline-buffer-id "blue4" 'global '(color x)))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1363 (unless font
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1364 (when (featurep 'x)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1365 (set-face-font 'modeline-buffer-id [bold-italic] nil '(mono x))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1366 (set-face-font 'modeline-buffer-id [bold-italic] nil '(grayscale x)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1367 (when (featurep 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1368 (set-face-font 'modeline-buffer-id [bold-italic] nil 'tty)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (set-face-parent 'modeline-buffer-id 'modeline nil nil 'append)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 ;; modeline-mousable:
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1372 (unless (face-differs-from-default-p 'modeline-mousable device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1373 (let ((fg (face-foreground 'modeline-mousable 'global))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1374 (font (face-font 'modeline-mousable 'global)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1375 (when (and (null fg) (featurep 'x))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 86
diff changeset
1376 (set-face-foreground 'modeline-mousable "firebrick" 'global '(color x)))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1377 (unless font
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1378 (when (featurep 'x)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1379 (set-face-font 'modeline-mousable [bold] nil '(mono x))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1380 (set-face-font 'modeline-mousable [bold] nil '(grayscale x))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 (set-face-parent 'modeline-mousable 'modeline nil nil 'append)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 ;; modeline-mousable-minor-mode:
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1384 (unless (face-differs-from-default-p 'modeline-mousable-minor-mode device)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1385 (let ((fg (face-foreground 'modeline-mousable-minor-mode 'global)))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1386 (when (and (null fg) (featurep 'x))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1387 (set-face-foreground 'modeline-mousable-minor-mode
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1388 '(((color x) . "green4")
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 86
diff changeset
1389 ((color x) . "forestgreen")) 'global))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 (set-face-parent 'modeline-mousable-minor-mode 'modeline-mousable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 nil nil 'append)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1394 ;; New function with 20.1, suggested by Per Abrahamsen, coded by Kyle Jones.
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1395 (defun set-face-stipple (face pixmap &optional frame)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1396 "Change the stipple pixmap of face FACE to PIXMAP.
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1397 This is an Emacs compatibility function; consider using
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1398 set-face-background-pixmap instead.
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1399
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1400 PIXMAP should be a string, the name of a file of pixmap data.
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1401 The directories listed in the `x-bitmap-file-path' variable are searched.
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1402 Any kind of image file for which XEmacs has builtin support can be used.
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1403
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1404 Alternatively, PIXMAP may be a list of the form (WIDTH HEIGHT
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1405 DATA) where WIDTH and HEIGHT are the size in pixels, and DATA is
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1406 a string, containing the raw bits of the bitmap. XBM data is
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1407 expected in this case, other types of image data will not work.
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1408
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1409 If the optional FRAME argument is provided, change only
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1410 in that frame; otherwise change each frame."
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1411 (while (not (find-face face))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1412 (setq face (signal 'wrong-type-argument (list 'facep face))))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1413 (while (cond ((stringp pixmap)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1414 (unless (file-readable-p pixmap)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1415 (setq pixmap (vector 'xbm ':file pixmap)))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1416 nil)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1417 ((and (consp pixmap) (= (length pixmap) 3))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1418 (setq pixmap (vector 'xbm ':data pixmap))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1419 nil)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1420 (t t))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1421 (setq pixmap (signal 'wrong-type-argument
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1422 (list 'stipple-pixmap-p pixmap))))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1423 (while (and frame (not (framep frame)))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1424 (setq frame (signal 'wrong-type-argument (list 'framep frame))))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1425 (set-face-background-pixmap face pixmap frame))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1426
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 ;; Create the remaining standard faces now. This way, packages that we dump
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 ;; can reference these faces as parents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 ;; The default, modeline, left-margin, right-margin, text-cursor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 ;; and pointer faces are created in C.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 (make-face 'bold "bold text")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 (make-face 'italic "italic text")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 (make-face 'bold-italic "bold-italic text")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 (make-face 'underline "underlined text")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 (or (face-differs-from-default-p 'underline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 (set-face-underline-p 'underline t 'global))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 (make-face 'zmacs-region "used on defined region between point and mark")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 (make-face 'isearch "used on region matched by isearch")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 (make-face 'list-mode-item-selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 "Face for the selected list item in list-mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 (make-face 'highlight "highlight face")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 (make-face 'primary-selection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 (make-face 'secondary-selection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1448 (loop for color in '("red" "green" "blue" "yellow") do
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1449 (make-face (intern color) (concat color " text"))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1450 (set-face-foreground (intern color) color nil 'color))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 ;; Make some useful faces. This happens very early, before creating
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 ;; the first non-stream device. We initialize the tty global values here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 ;; We cannot initialize the X global values here because they depend
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 ;; on having already resourced the global face specs, which happens
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 ;; when the first X device is created.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 (set-face-background-pixmap 'modeline [nothing])
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1459
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1460 (when (featurep 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1461 (set-face-highlight-p 'bold t 'global 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1462 (set-face-underline-p 'italic t 'global 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1463 (set-face-highlight-p 'bold-italic t 'global 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1464 (set-face-underline-p 'bold-italic t 'global 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1465 (set-face-highlight-p 'highlight t 'global 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1466 (set-face-reverse-p 'text-cursor t 'global 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1467 (set-face-reverse-p 'modeline t 'global 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1468 (set-face-reverse-p 'zmacs-region t 'global 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1469 (set-face-reverse-p 'list-mode-item-selected t 'global 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1470 (set-face-reverse-p 'isearch t 'global 'tty)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
1471 )
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1472
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 108
diff changeset
1473 ;;; faces.el ends here