annotate lisp/faces.el @ 670:12095b04a9b6

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