Mercurial > emacs
annotate lisp/faces.el @ 63440:b6c58942036d
*** empty log message ***
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Tue, 14 Jun 2005 21:12:41 +0000 |
parents | 9cbfa983c1cf |
children | c449f070995c e58cb448e07c a1b34dec1104 |
rev | line source |
---|---|
25012 | 1 ;;; faces.el --- Lisp faces |
2456 | 2 |
63382
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
3 ;; Copyright (C) 1992,1993,1994,1995,1996,1998,1999,2000,2001,2002,2004,2005 |
25012 | 4 ;; Free Software Foundation, Inc. |
2456 | 5 |
38697
a19197c6442f
Keyword added and FSF specified as Maintainer.
Pavel Janík <Pavel@Janik.cz>
parents:
38233
diff
changeset
|
6 ;; Maintainer: FSF |
45078 | 7 ;; Keywords: internal |
38697
a19197c6442f
Keyword added and FSF specified as Maintainer.
Pavel Janík <Pavel@Janik.cz>
parents:
38233
diff
changeset
|
8 |
2456 | 9 ;; This file is part of GNU Emacs. |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
14169 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
2456 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;;; Code: | |
29 | |
10107
2af74ff52cd0
At compile time, discard any defsubr definitions
Richard M. Stallman <rms@gnu.org>
parents:
10105
diff
changeset
|
30 (eval-when-compile |
31528
a461cad7a942
(face-x-resources): Make custom type more specific.
Dave Love <fx@gnu.org>
parents:
31500
diff
changeset
|
31 (require 'cl) |
a461cad7a942
(face-x-resources): Make custom type more specific.
Dave Love <fx@gnu.org>
parents:
31500
diff
changeset
|
32 ;; Warning suppression -- can't require x-win in batch: |
a461cad7a942
(face-x-resources): Make custom type more specific.
Dave Love <fx@gnu.org>
parents:
31500
diff
changeset
|
33 (autoload 'xw-defined-colors "x-win")) |
2456 | 34 |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
35 |
25012 | 36 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
37 ;;; Font selection. | |
38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2456 | 39 |
25012 | 40 (defgroup font-selection nil |
41 "Influencing face font selection." | |
42 :group 'faces) | |
2456 | 43 |
12562
a9b08e50d6ec
(x-create-frame-with-faces): Set background-mode
Karl Heuer <kwzh@gnu.org>
parents:
12475
diff
changeset
|
44 |
25012 | 45 (defcustom face-font-selection-order |
46 '(:width :height :weight :slant) | |
47 "*A list specifying how face font selection chooses fonts. | |
48 Each of the four symbols `:width', `:height', `:weight', and `:slant' | |
49 must appear once in the list, and the list must not contain any other | |
50 elements. Font selection tries to find a best matching font for | |
51 those face attributes first that appear first in the list. For | |
52 example, if `:slant' appears before `:height', font selection first | |
53 tries to find a font with a suitable slant, even if this results in | |
54 a font height that isn't optimal." | |
48713
a91fa6973510
(face-font-selection-order)
Andreas Schwab <schwab@suse.de>
parents:
48522
diff
changeset
|
55 :tag "Font selection order" |
30306
7a694e8efd12
(face-font-selection-order)
Gerd Moellmann <gerd@gnu.org>
parents:
30188
diff
changeset
|
56 :type '(list symbol symbol symbol symbol) |
25012 | 57 :group 'font-selection |
58 :set #'(lambda (symbol value) | |
59 (set-default symbol value) | |
60 (internal-set-font-selection-order value))) | |
17522
209c61e51bd0
(frame-set-background-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents:
17386
diff
changeset
|
61 |
33371
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
62 |
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
63 ;; This is defined originally in xfaces.c. |
25012 | 64 (defcustom face-font-family-alternatives |
65 '(("courier" "fixed") | |
27888
3e1c17057b79
(face-font-family-alternatives): Add arial to helv.
Jason Rumney <jasonr@gnu.org>
parents:
27831
diff
changeset
|
66 ("helv" "helvetica" "arial" "fixed")) |
25012 | 67 "*Alist of alternative font family names. |
42705 | 68 Each element has the form (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...). |
25012 | 69 If fonts of family FAMILY can't be loaded, try ALTERNATIVE1, then |
70 ALTERNATIVE2 etc." | |
48713
a91fa6973510
(face-font-selection-order)
Andreas Schwab <schwab@suse.de>
parents:
48522
diff
changeset
|
71 :tag "Alternative font families to try" |
30306
7a694e8efd12
(face-font-selection-order)
Gerd Moellmann <gerd@gnu.org>
parents:
30188
diff
changeset
|
72 :type '(repeat (repeat string)) |
25012 | 73 :group 'font-selection |
74 :set #'(lambda (symbol value) | |
75 (set-default symbol value) | |
76 (internal-set-alternative-font-family-alist value))) | |
13725 | 77 |
25012 | 78 |
33371
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
79 ;; This is defined originally in xfaces.c. |
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
80 (defcustom face-font-registry-alternatives |
39549
044b46ec5fff
(face-font-registry-alternatives) [windows-nt]: Make
Andrew Innes <andrewi@gnu.org>
parents:
38697
diff
changeset
|
81 (if (eq system-type 'windows-nt) |
42969
bdcf2b5f4ae2
(face-font-registry-alternatives) [windows-nt]: Add
Jason Rumney <jasonr@gnu.org>
parents:
42705
diff
changeset
|
82 '(("iso8859-1" "ms-oemlatin") |
bdcf2b5f4ae2
(face-font-registry-alternatives) [windows-nt]: Add
Jason Rumney <jasonr@gnu.org>
parents:
42705
diff
changeset
|
83 ("gb2312.1980" "gb2312") |
39549
044b46ec5fff
(face-font-registry-alternatives) [windows-nt]: Make
Andrew Innes <andrewi@gnu.org>
parents:
38697
diff
changeset
|
84 ("jisx0208.1990" "jisx0208.1983" "jisx0208.1978") |
044b46ec5fff
(face-font-registry-alternatives) [windows-nt]: Make
Andrew Innes <andrewi@gnu.org>
parents:
38697
diff
changeset
|
85 ("ksc5601.1989" "ksx1001.1992" "ksc5601.1987") |
044b46ec5fff
(face-font-registry-alternatives) [windows-nt]: Make
Andrew Innes <andrewi@gnu.org>
parents:
38697
diff
changeset
|
86 ("muletibetan-2" "muletibetan-0")) |
044b46ec5fff
(face-font-registry-alternatives) [windows-nt]: Make
Andrew Innes <andrewi@gnu.org>
parents:
38697
diff
changeset
|
87 '(("gb2312.1980" "gb2312.80&gb8565.88" "gbk*") |
044b46ec5fff
(face-font-registry-alternatives) [windows-nt]: Make
Andrew Innes <andrewi@gnu.org>
parents:
38697
diff
changeset
|
88 ("jisx0208.1990" "jisx0208.1983" "jisx0208.1978") |
044b46ec5fff
(face-font-registry-alternatives) [windows-nt]: Make
Andrew Innes <andrewi@gnu.org>
parents:
38697
diff
changeset
|
89 ("ksc5601.1989" "ksx1001.1992" "ksc5601.1987") |
044b46ec5fff
(face-font-registry-alternatives) [windows-nt]: Make
Andrew Innes <andrewi@gnu.org>
parents:
38697
diff
changeset
|
90 ("muletibetan-2" "muletibetan-0"))) |
33371
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
91 "*Alist of alternative font registry names. |
42705 | 92 Each element has the form (REGISTRY ALTERNATIVE1 ALTERNATIVE2 ...). |
34162
08b928780fd1
(face-font-registry-alternatives): Add entries for CJK
Kenichi Handa <handa@m17n.org>
parents:
34018
diff
changeset
|
93 If fonts of registry REGISTRY can be loaded, font selection |
08b928780fd1
(face-font-registry-alternatives): Add entries for CJK
Kenichi Handa <handa@m17n.org>
parents:
34018
diff
changeset
|
94 tries to find a best matching font among all fonts of registry |
08b928780fd1
(face-font-registry-alternatives): Add entries for CJK
Kenichi Handa <handa@m17n.org>
parents:
34018
diff
changeset
|
95 REGISTRY, ALTERNATIVE1, ALTERNATIVE2, and etc." |
48713
a91fa6973510
(face-font-selection-order)
Andreas Schwab <schwab@suse.de>
parents:
48522
diff
changeset
|
96 :tag "Alternative font registries to try" |
33371
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
97 :type '(repeat (repeat string)) |
33419
21ac2c51ac59
(face-font-registry-alternatives): Add :version.
Dave Love <fx@gnu.org>
parents:
33371
diff
changeset
|
98 :version "21.1" |
33371
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
99 :group 'font-selection |
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
100 :set #'(lambda (symbol value) |
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
101 (set-default symbol value) |
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
102 (internal-set-alternative-font-registry-alist value))) |
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
103 |
8259eb8d96c2
(face-font-registry-alternatives): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
33008
diff
changeset
|
104 |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
105 |
25012 | 106 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
107 ;;; Creation, copying. | |
108 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
109 |
3925
f286657c098e
* faces.el (global-face-data): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
3911
diff
changeset
|
110 |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
111 (defun face-list () |
25012 | 112 "Return a list of all defined face names." |
113 (mapcar #'car face-new-frame-defaults)) | |
114 | |
115 | |
116 ;;; ### If not frame-local initialize by what X resources? | |
117 | |
118 (defun make-face (face &optional no-init-from-resources) | |
119 "Define a new face with name FACE, a symbol. | |
120 NO-INIT-FROM-RESOURCES non-nil means don't initialize frame-local | |
121 variants of FACE from X resources. (X resources recognized are found | |
122 in the global variable `face-x-resources'.) If FACE is already known | |
123 as a face, leave it unmodified. Value is FACE." | |
124 (interactive "SMake face: ") | |
125 (unless (facep face) | |
126 ;; Make frame-local faces (this also makes the global one). | |
127 (dolist (frame (frame-list)) | |
128 (internal-make-lisp-face face frame)) | |
129 ;; Add the face to the face menu. | |
130 (when (fboundp 'facemenu-add-new-face) | |
131 (facemenu-add-new-face face)) | |
132 ;; Define frame-local faces for all frames from X resources. | |
133 (unless no-init-from-resources | |
134 (make-face-x-resource-internal face))) | |
135 face) | |
136 | |
137 | |
138 (defun make-empty-face (face) | |
139 "Define a new, empty face with name FACE. | |
140 If the face already exists, it is left unmodified. Value is FACE." | |
141 (interactive "SMake empty face: ") | |
142 (make-face face 'no-init-from-resources)) | |
143 | |
144 | |
145 (defun copy-face (old-face new-face &optional frame new-frame) | |
146 "Define a face just like OLD-FACE, with name NEW-FACE. | |
147 | |
148 If NEW-FACE already exists as a face, it is modified to be like | |
149 OLD-FACE. If it doesn't already exist, it is created. | |
150 | |
47258
86c1fc3c48f5
(copy-face): Fix spacing.
Juanma Barranquero <lekktu@gmail.com>
parents:
46267
diff
changeset
|
151 If the optional argument FRAME is given as a frame, NEW-FACE is |
25012 | 152 changed on FRAME only. |
153 If FRAME is t, the frame-independent default specification for OLD-FACE | |
154 is copied to NEW-FACE. | |
155 If FRAME is nil, copying is done for the frame-independent defaults | |
156 and for each existing frame. | |
157 | |
158 If the optional fourth argument NEW-FRAME is given, | |
159 copy the information from face OLD-FACE on frame FRAME | |
160 to NEW-FACE on frame NEW-FRAME." | |
161 (let ((inhibit-quit t)) | |
162 (if (null frame) | |
163 (progn | |
164 (dolist (frame (frame-list)) | |
165 (copy-face old-face new-face frame)) | |
166 (copy-face old-face new-face t)) | |
167 (internal-copy-lisp-face old-face new-face frame new-frame)) | |
168 new-face)) | |
169 | |
170 | |
171 | |
172 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
173 ;;; Obsolete functions | |
174 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
175 | |
176 ;; The functions in this section are defined because Lisp packages use | |
177 ;; them, despite the prefix `internal-' suggesting that they are | |
28840 | 178 ;; private to the face implementation. |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
179 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
180 (defun internal-find-face (name &optional frame) |
25012 | 181 "Retrieve the face named NAME. |
182 Return nil if there is no such face. | |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
183 If the optional argument FRAME is given, this gets the face NAME for |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
184 that frame; otherwise, it uses the selected frame. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
185 If FRAME is the symbol t, then the global, non-frame face is returned. |
62947
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
186 If NAME is already a face, it is simply returned." |
25012 | 187 (facep name)) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
188 (make-obsolete 'internal-find-face 'facep "21.1") |
25012 | 189 |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
190 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
191 (defun internal-get-face (name &optional frame) |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
192 "Retrieve the face named NAME; error if there is none. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
193 If the optional argument FRAME is given, this gets the face NAME for |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
194 that frame; otherwise, it uses the selected frame. |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
195 If FRAME is the symbol t, then the global, non-frame face is returned. |
46053
ef0684c3e07b
(frame-update-faces): Fix obsolescence declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
46041
diff
changeset
|
196 If NAME is already a face, it is simply returned." |
40351
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
197 (or (facep name) |
25012 | 198 (check-face name))) |
46053
ef0684c3e07b
(frame-update-faces): Fix obsolescence declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
46041
diff
changeset
|
199 (make-obsolete 'internal-get-face "see `facep' and `check-face'." "21.1") |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
200 |
25012 | 201 |
202 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
203 ;;; Predicates, type checks. | |
204 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
205 | |
206 (defun facep (face) | |
207 "Return non-nil if FACE is a face name." | |
208 (internal-lisp-face-p face)) | |
209 | |
210 | |
211 (defun check-face (face) | |
212 "Signal an error if FACE doesn't name a face. | |
213 Value is FACE." | |
214 (unless (facep face) | |
215 (error "Not a face: %s" face)) | |
216 face) | |
2744
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
217 |
f4fc0c4c76f9
Re-arranged stuff to put defsubst accessors at the top
Jim Blandy <jimb@redhat.com>
parents:
2715
diff
changeset
|
218 |
25012 | 219 ;; The ID returned is not to be confused with the internally used IDs |
220 ;; of realized faces. The ID assigned to Lisp faces is used to | |
221 ;; support faces in display table entries. | |
17386
b251c8820860
(make-face): New arg no-resources.
Richard M. Stallman <rms@gnu.org>
parents:
17173
diff
changeset
|
222 |
25012 | 223 (defun face-id (face &optional frame) |
46267
cd9282aa1d8a
(face-id): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
46146
diff
changeset
|
224 "Return the internal ID of face with name FACE. |
60495 | 225 The optional argument FRAME is ignored, since the internal face ID |
226 of a face name is the same for all frames." | |
25012 | 227 (check-face face) |
228 (get face 'face)) | |
2456 | 229 |
230 | |
231 (defun face-equal (face1 face2 &optional frame) | |
25012 | 232 "Non-nil if faces FACE1 and FACE2 are equal. |
233 Faces are considered equal if all their attributes are equal. | |
62968
88922a349851
(face-equal): Improve argument/docstring consistency.
Juanma Barranquero <lekktu@gmail.com>
parents:
62947
diff
changeset
|
234 If the optional argument FRAME is given, report on FACE1 and FACE2 in that frame. |
88922a349851
(face-equal): Improve argument/docstring consistency.
Juanma Barranquero <lekktu@gmail.com>
parents:
62947
diff
changeset
|
235 If FRAME is t, report on the defaults for FACE1 and FACE2 (for new frames). |
25012 | 236 If FRAME is omitted or nil, use the selected frame." |
237 (internal-lisp-face-equal-p face1 face2 frame)) | |
238 | |
2456 | 239 |
240 (defun face-differs-from-default-p (face &optional frame) | |
55899
4592654cd2e9
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-369
Miles Bader <miles@gnu.org>
parents:
55898
diff
changeset
|
241 "Return non-nil if FACE displays differently from the default face. |
25012 | 242 If the optional argument FRAME is given, report on face FACE in that frame. |
243 If FRAME is t, report on the defaults for face FACE (for new frames). | |
55899
4592654cd2e9
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-369
Miles Bader <miles@gnu.org>
parents:
55898
diff
changeset
|
244 If FRAME is omitted or nil, use the selected frame." |
55902
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
245 (let ((attrs |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
246 '(:family :width :height :weight :slant :foreground |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
247 :foreground :background :underline :overline |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
248 :strike-through :box :inverse-video)) |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
249 (differs nil)) |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
250 (while (and attrs (not differs)) |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
251 (let* ((attr (pop attrs)) |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
252 (attr-val (face-attribute face attr frame t))) |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
253 (when (and |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
254 (not (eq attr-val 'unspecified)) |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
255 (display-supports-face-attributes-p (list attr attr-val) |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
256 frame)) |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
257 (setq differs attr)))) |
084530cb1b2f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Miles Bader <miles@gnu.org>
parents:
55901
diff
changeset
|
258 differs)) |
10379
f9d713e8c77c
(face-nontrivial-p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10375
diff
changeset
|
259 |
2456 | 260 |
10379
f9d713e8c77c
(face-nontrivial-p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10375
diff
changeset
|
261 (defun face-nontrivial-p (face &optional frame) |
f9d713e8c77c
(face-nontrivial-p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10375
diff
changeset
|
262 "True if face FACE has some non-nil attribute. |
25012 | 263 If the optional argument FRAME is given, report on face FACE in that frame. |
264 If FRAME is t, report on the defaults for face FACE (for new frames). | |
265 If FRAME is omitted or nil, use the selected frame." | |
266 (not (internal-lisp-face-empty-p face frame))) | |
267 | |
268 | |
269 | |
270 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
271 ;;; Setting face attributes from X resources. | |
272 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
273 | |
274 (defcustom face-x-resources | |
275 '((:family (".attributeFamily" . "Face.AttributeFamily")) | |
276 (:width (".attributeWidth" . "Face.AttributeWidth")) | |
277 (:height (".attributeHeight" . "Face.AttributeHeight")) | |
278 (:weight (".attributeWeight" . "Face.AttributeWeight")) | |
279 (:slant (".attributeSlant" . "Face.AttributeSlant")) | |
280 (:foreground (".attributeForeground" . "Face.AttributeForeground")) | |
281 (:background (".attributeBackground" . "Face.AttributeBackground")) | |
282 (:overline (".attributeOverline" . "Face.AttributeOverline")) | |
283 (:strike-through (".attributeStrikeThrough" . "Face.AttributeStrikeThrough")) | |
284 (:box (".attributeBox" . "Face.AttributeBox")) | |
285 (:underline (".attributeUnderline" . "Face.AttributeUnderline")) | |
286 (:inverse-video (".attributeInverse" . "Face.AttributeInverse")) | |
287 (:stipple | |
288 (".attributeStipple" . "Face.AttributeStipple") | |
289 (".attributeBackgroundPixmap" . "Face.AttributeBackgroundPixmap")) | |
290 (:bold (".attributeBold" . "Face.AttributeBold")) | |
291 (:italic (".attributeItalic" . "Face.AttributeItalic")) | |
31193
a15c5cb8ec71
(face-x-resources): Add entry for :inherit.
Miles Bader <miles@gnu.org>
parents:
31190
diff
changeset
|
292 (:font (".attributeFont" . "Face.AttributeFont")) |
a15c5cb8ec71
(face-x-resources): Add entry for :inherit.
Miles Bader <miles@gnu.org>
parents:
31190
diff
changeset
|
293 (:inherit (".attributeInherit" . "Face.AttributeInherit"))) |
25012 | 294 "*List of X resources and classes for face attributes. |
295 Each element has the form (ATTRIBUTE ENTRY1 ENTRY2...) where ATTRIBUTE is | |
296 the name of a face attribute, and each ENTRY is a cons of the form | |
39830
aed9c3afb7ed
(describe-face): Call help-setup-xref earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39799
diff
changeset
|
297 \(RESOURCE . CLASS) with RESOURCE being the resource and CLASS being the |
25012 | 298 X resource class for the attribute." |
31528
a461cad7a942
(face-x-resources): Make custom type more specific.
Dave Love <fx@gnu.org>
parents:
31500
diff
changeset
|
299 :type '(repeat (cons symbol (repeat (cons string string)))) |
25012 | 300 :group 'faces) |
301 | |
302 | |
303 (defun set-face-attribute-from-resource (face attribute resource class frame) | |
304 "Set FACE's ATTRIBUTE from X resource RESOURCE, class CLASS on FRAME. | |
305 Value is the attribute value specified by the resource, or nil | |
306 if not present. This function displays a message if the resource | |
307 specifies an invalid attribute." | |
308 (let* ((face-name (face-name face)) | |
309 (value (internal-face-x-get-resource (concat face-name resource) | |
310 class frame))) | |
311 (when value | |
312 (condition-case () | |
313 (internal-set-lisp-face-attribute-from-resource | |
314 face attribute (downcase value) frame) | |
315 (error | |
316 (message "Face %s, frame %s: invalid attribute %s %s from X resource" | |
317 face-name frame attribute value)))) | |
318 value)) | |
319 | |
320 | |
321 (defun set-face-attributes-from-resources (face frame) | |
322 "Set attributes of FACE from X resources for FRAME." | |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32734
diff
changeset
|
323 (when (memq (framep frame) '(x w32 mac)) |
25012 | 324 (dolist (definition face-x-resources) |
325 (let ((attribute (car definition))) | |
326 (dolist (entry (cdr definition)) | |
327 (set-face-attribute-from-resource face attribute (car entry) | |
328 (cdr entry) frame)))))) | |
37943 | 329 |
330 | |
25012 | 331 (defun make-face-x-resource-internal (face &optional frame) |
332 "Fill frame-local FACE on FRAME from X resources. | |
333 FRAME nil or not specified means do it for all frames." | |
334 (if (null frame) | |
335 (dolist (frame (frame-list)) | |
336 (set-face-attributes-from-resources face frame)) | |
337 (set-face-attributes-from-resources face frame))) | |
338 | |
339 | |
340 | |
341 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
342 ;;; Retrieving face attributes. | |
343 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
344 | |
345 (defun face-name (face) | |
346 "Return the name of face FACE." | |
347 (symbol-name (check-face face))) | |
348 | |
349 | |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
350 (defun face-attribute (face attribute &optional frame inherit) |
25012 | 351 "Return the value of FACE's ATTRIBUTE on FRAME. |
352 If the optional argument FRAME is given, report on face FACE in that frame. | |
353 If FRAME is t, report on the defaults for face FACE (for new frames). | |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
354 If FRAME is omitted or nil, use the selected frame. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
355 |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
356 If INHERIT is nil, only attributes directly defined by FACE are considered, |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
357 so the return value may be `unspecified', or a relative value. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
358 If INHERIT is non-nil, FACE's definition of ATTRIBUTE is merged with the |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
359 faces specified by its `:inherit' attribute; however the return value |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
360 may still be `unspecified' or relative. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
361 If INHERIT is a face or a list of faces, then the result is further merged |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
362 with that face (or faces), until it becomes specified and absolute. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
363 |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
364 To ensure that the return value is always specified and absolute, use a |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
365 value of `default' for INHERIT; this will resolve any unspecified or |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
366 relative values by merging with the `default' face (which is always |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
367 completely specified)." |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
368 (let ((value (internal-get-lisp-face-attribute face attribute frame))) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
369 (when (and inherit (face-attribute-relative-p attribute value)) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
370 ;; VALUE is relative, so merge with inherited faces |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
371 (let ((inh-from (face-attribute face :inherit frame))) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
372 (unless (or (null inh-from) (eq inh-from 'unspecified)) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
373 (setq value |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
374 (face-attribute-merged-with attribute value inh-from frame))))) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
375 (when (and inherit |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
376 (not (eq inherit t)) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
377 (face-attribute-relative-p attribute value)) |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
378 ;; We should merge with INHERIT as well |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
379 (setq value (face-attribute-merged-with attribute value inherit frame))) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
380 value)) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
381 |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
382 (defun face-attribute-merged-with (attribute value faces &optional frame) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
383 "Merges ATTRIBUTE, initially VALUE, with faces from FACES until absolute. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
384 FACES may be either a single face or a list of faces. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
385 \[This is an internal function]" |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
386 (cond ((not (face-attribute-relative-p attribute value)) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
387 value) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
388 ((null faces) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
389 value) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
390 ((consp faces) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
391 (face-attribute-merged-with |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
392 attribute |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
393 (face-attribute-merged-with attribute value (car faces) frame) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
394 (cdr faces) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
395 frame)) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
396 (t |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
397 (merge-face-attribute attribute |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
398 value |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
399 (face-attribute faces attribute frame t))))) |
25012 | 400 |
401 | |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
402 (defmacro face-attribute-specified-or (value &rest body) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
403 "Return VALUE, unless it's `unspecified', in which case evaluate BODY and return the result." |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
404 (let ((temp (make-symbol "value"))) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
405 `(let ((,temp ,value)) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
406 (if (not (eq ,temp 'unspecified)) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
407 ,temp |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
408 ,@body)))) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
409 |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
410 (defun face-foreground (face &optional frame inherit) |
25012 | 411 "Return the foreground color name of FACE, or nil if unspecified. |
412 If the optional argument FRAME is given, report on face FACE in that frame. | |
413 If FRAME is t, report on the defaults for face FACE (for new frames). | |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
414 If FRAME is omitted or nil, use the selected frame. |
25012 | 415 |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
416 If INHERIT is nil, only a foreground color directly defined by FACE is |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
417 considered, so the return value may be nil. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
418 If INHERIT is t, and FACE doesn't define a foreground color, then any |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
419 foreground color that FACE inherits through its `:inherit' attribute |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
420 is considered as well; however the return value may still be nil. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
421 If INHERIT is a face or a list of faces, then it is used to try to |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
422 resolve an unspecified foreground color. |
25012 | 423 |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
424 To ensure that a valid color is always returned, use a value of |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
425 `default' for INHERIT; this will resolve any unspecified values by |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
426 merging with the `default' face (which is always completely specified)." |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
427 (face-attribute-specified-or (face-attribute face :foreground frame inherit) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
428 nil)) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
429 |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
430 (defun face-background (face &optional frame inherit) |
25012 | 431 "Return the background color name of FACE, or nil if unspecified. |
432 If the optional argument FRAME is given, report on face FACE in that frame. | |
433 If FRAME is t, report on the defaults for face FACE (for new frames). | |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
434 If FRAME is omitted or nil, use the selected frame. |
25012 | 435 |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
436 If INHERIT is nil, only a background color directly defined by FACE is |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
437 considered, so the return value may be nil. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
438 If INHERIT is t, and FACE doesn't define a background color, then any |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
439 background color that FACE inherits through its `:inherit' attribute |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
440 is considered as well; however the return value may still be nil. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
441 If INHERIT is a face or a list of faces, then it is used to try to |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
442 resolve an unspecified background color. |
25012 | 443 |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
444 To ensure that a valid color is always returned, use a value of |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
445 `default' for INHERIT; this will resolve any unspecified values by |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
446 merging with the `default' face (which is always completely specified)." |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
447 (face-attribute-specified-or (face-attribute face :background frame inherit) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
448 nil)) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
449 |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
450 (defun face-stipple (face &optional frame inherit) |
25012 | 451 "Return the stipple pixmap name of FACE, or nil if unspecified. |
452 If the optional argument FRAME is given, report on face FACE in that frame. | |
453 If FRAME is t, report on the defaults for face FACE (for new frames). | |
40399
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
454 If FRAME is omitted or nil, use the selected frame. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
455 |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
456 If INHERIT is nil, only a stipple directly defined by FACE is |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
457 considered, so the return value may be nil. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
458 If INHERIT is t, and FACE doesn't define a stipple, then any stipple |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
459 that FACE inherits through its `:inherit' attribute is considered as |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
460 well; however the return value may still be nil. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
461 If INHERIT is a face or a list of faces, then it is used to try to |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
462 resolve an unspecified stipple. |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
463 |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
464 To ensure that a valid stipple or nil is always returned, use a value of |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
465 `default' for INHERIT; this will resolve any unspecified values by merging |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
466 with the `default' face (which is always completely specified)." |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
467 (face-attribute-specified-or (face-attribute face :stipple frame inherit) |
3e67855bb4bf
(face-attribute): Add INHERIT argument, consider face inheritance if non-nil.
Miles Bader <miles@gnu.org>
parents:
40351
diff
changeset
|
468 nil)) |
25012 | 469 |
470 | |
471 (defalias 'face-background-pixmap 'face-stipple) | |
472 | |
473 | |
474 (defun face-underline-p (face &optional frame) | |
475 "Return non-nil if FACE is underlined. | |
476 If the optional argument FRAME is given, report on face FACE in that frame. | |
477 If FRAME is t, report on the defaults for face FACE (for new frames). | |
478 If FRAME is omitted or nil, use the selected frame." | |
479 (eq (face-attribute face :underline frame) t)) | |
480 | |
481 | |
482 (defun face-inverse-video-p (face &optional frame) | |
483 "Return non-nil if FACE is in inverse video on FRAME. | |
484 If the optional argument FRAME is given, report on face FACE in that frame. | |
485 If FRAME is t, report on the defaults for face FACE (for new frames). | |
486 If FRAME is omitted or nil, use the selected frame." | |
487 (eq (face-attribute face :inverse-video frame) t)) | |
488 | |
489 | |
490 (defun face-bold-p (face &optional frame) | |
491 "Return non-nil if the font of FACE is bold on FRAME. | |
492 If the optional argument FRAME is given, report on face FACE in that frame. | |
493 If FRAME is t, report on the defaults for face FACE (for new frames). | |
494 If FRAME is omitted or nil, use the selected frame. | |
495 Use `face-attribute' for finer control." | |
496 (let ((bold (face-attribute face :weight frame))) | |
25561
67c224f5cc1a
(face-bold-p): Don't return t if face has lighter
Gerd Moellmann <gerd@gnu.org>
parents:
25545
diff
changeset
|
497 (memq bold '(semi-bold bold extra-bold ultra-bold)))) |
25012 | 498 |
499 | |
500 (defun face-italic-p (face &optional frame) | |
501 "Return non-nil if the font of FACE is italic on FRAME. | |
502 If the optional argument FRAME is given, report on face FACE in that frame. | |
503 If FRAME is t, report on the defaults for face FACE (for new frames). | |
504 If FRAME is omitted or nil, use the selected frame. | |
505 Use `face-attribute' for finer control." | |
506 (let ((italic (face-attribute face :slant frame))) | |
25616
4dbea85f5af0
(face-italic-p): Return t only for values `italic'
Gerd Moellmann <gerd@gnu.org>
parents:
25588
diff
changeset
|
507 (memq italic '(italic oblique)))) |
37943 | 508 |
25012 | 509 |
510 | |
511 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
512 ;;; Face documentation. | |
513 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
514 | |
515 (defun face-documentation (face) | |
516 "Get the documentation string for FACE." | |
517 (get face 'face-documentation)) | |
518 | |
519 | |
520 (defun set-face-documentation (face string) | |
521 "Set the documentation string for FACE to STRING." | |
26927
27d6c0e07ea8
(set-face-attribute): Purecopy the attributes set.
Dave Love <fx@gnu.org>
parents:
26902
diff
changeset
|
522 ;; Perhaps the text should go in DOC. |
26657
b5c0d55411ad
(set-face-documentation): Purecopy STRING.
Dave Love <fx@gnu.org>
parents:
26353
diff
changeset
|
523 (put face 'face-documentation (purecopy string))) |
25012 | 524 |
525 | |
526 (defalias 'face-doc-string 'face-documentation) | |
527 (defalias 'set-face-doc-string 'set-face-documentation) | |
528 | |
529 | |
530 | |
531 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
532 ;; Setting face attributes. | |
533 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
534 | |
535 | |
536 (defun set-face-attribute (face frame &rest args) | |
537 "Set attributes of FACE on FRAME from ARGS. | |
538 | |
539 FRAME nil means change attributes on all frames. FRAME t means change | |
540 the default for new frames (this is done automatically each time an | |
541 attribute is changed on all frames). | |
542 | |
543 ARGS must come in pairs ATTRIBUTE VALUE. ATTRIBUTE must be a valid | |
544 face attribute name. All attributes can be set to `unspecified'; | |
545 this fact is not further mentioned below. | |
546 | |
547 The following attributes are recognized: | |
548 | |
549 `:family' | |
550 | |
551 VALUE must be a string specifying the font family, e.g. ``courier'', | |
552 or a fontset alias name. If a font family is specified, wild-cards `*' | |
553 and `?' are allowed. | |
554 | |
555 `:width' | |
556 | |
557 VALUE specifies the relative proportionate width of the font to use. | |
558 It must be one of the symbols `ultra-condensed', `extra-condensed', | |
559 `condensed', `semi-condensed', `normal', `semi-expanded', `expanded', | |
560 `extra-expanded', or `ultra-expanded'. | |
561 | |
562 `:height' | |
563 | |
31190 | 564 VALUE must be either an integer specifying the height of the font to use |
565 in 1/10 pt, a floating point number specifying the amount by which to | |
566 scale any underlying face, or a function, which is called with the old | |
567 height (from the underlying face), and should return the new height. | |
25012 | 568 |
569 `:weight' | |
570 | |
571 VALUE specifies the weight of the font to use. It must be one of the | |
572 symbols `ultra-bold', `extra-bold', `bold', `semi-bold', `normal', | |
573 `semi-light', `light', `extra-light', `ultra-light'. | |
574 | |
575 `:slant' | |
576 | |
577 VALUE specifies the slant of the font to use. It must be one of the | |
578 symbols `italic', `oblique', `normal', `reverse-italic', or | |
579 `reverse-oblique'. | |
580 | |
581 `:foreground', `:background' | |
582 | |
583 VALUE must be a color name, a string. | |
584 | |
585 `:underline' | |
586 | |
587 VALUE specifies whether characters in FACE should be underlined. If | |
588 VALUE is t, underline with foreground color of the face. If VALUE is | |
589 a string, underline with that color. If VALUE is nil, explicitly | |
590 don't underline. | |
591 | |
592 `:overline' | |
593 | |
594 VALUE specifies whether characters in FACE should be overlined. If | |
595 VALUE is t, overline with foreground color of the face. If VALUE is a | |
596 string, overline with that color. If VALUE is nil, explicitly don't | |
597 overline. | |
598 | |
599 `:strike-through' | |
600 | |
601 VALUE specifies whether characters in FACE should be drawn with a line | |
602 striking through them. If VALUE is t, use the foreground color of the | |
603 face. If VALUE is a string, strike-through with that color. If VALUE | |
604 is nil, explicitly don't strike through. | |
605 | |
606 `:box' | |
607 | |
608 VALUE specifies whether characters in FACE should have a box drawn | |
609 around them. If VALUE is nil, explicitly don't draw boxes. If | |
610 VALUE is t, draw a box with lines of width 1 in the foreground color | |
611 of the face. If VALUE is a string, the string must be a color name, | |
612 and the box is drawn in that color with a line width of 1. Otherwise, | |
613 VALUE must be a property list of the form `(:line-width WIDTH | |
614 :color COLOR :style STYLE)'. If a keyword/value pair is missing from | |
615 the property list, a default value will be used for the value, as | |
616 specified below. WIDTH specifies the width of the lines to draw; it | |
36009
3f009240cc7d
(set-face-attribute): Describe the case of a negative
Kenichi Handa <handa@m17n.org>
parents:
34682
diff
changeset
|
617 defaults to 1. If WIDTH is negative, the absolute value is the width |
3f009240cc7d
(set-face-attribute): Describe the case of a negative
Kenichi Handa <handa@m17n.org>
parents:
34682
diff
changeset
|
618 of the lines, and draw top/bottom lines inside the characters area, |
3f009240cc7d
(set-face-attribute): Describe the case of a negative
Kenichi Handa <handa@m17n.org>
parents:
34682
diff
changeset
|
619 not around it. COLOR is the name of the color to draw in, default is |
25012 | 620 the foreground color of the face for simple boxes, and the background |
621 color of the face for 3D boxes. STYLE specifies whether a 3D box | |
622 should be draw. If STYLE is `released-button', draw a box looking | |
623 like a released 3D button. If STYLE is `pressed-button' draw a box | |
624 that appears like a pressed button. If STYLE is nil, the default if | |
625 the property list doesn't contain a style specification, draw a 2D | |
626 box. | |
627 | |
628 `:inverse-video' | |
629 | |
630 VALUE specifies whether characters in FACE should be displayed in | |
28840 | 631 inverse video. VALUE must be one of t or nil. |
25012 | 632 |
633 `:stipple' | |
634 | |
635 If VALUE is a string, it must be the name of a file of pixmap data. | |
636 The directories listed in the `x-bitmap-file-path' variable are | |
637 searched. Alternatively, VALUE may be a list of the form (WIDTH | |
638 HEIGHT DATA) where WIDTH and HEIGHT are the size in pixels, and DATA | |
639 is a string containing the raw bits of the bitmap. VALUE nil means | |
640 explicitly don't use a stipple pattern. | |
641 | |
642 For convenience, attributes `:family', `:width', `:height', `:weight', | |
643 and `:slant' may also be set in one step from an X font name: | |
644 | |
645 `:font' | |
646 | |
647 Set font-related face attributes from VALUE. VALUE must be a valid | |
648 XLFD font name. If it is a font name pattern, the first matching font | |
649 will be used. | |
650 | |
651 For compatibility with Emacs 20, keywords `:bold' and `:italic' can | |
652 be used to specify that a bold or italic font should be used. VALUE | |
31190 | 653 must be t or nil in that case. A value of `unspecified' is not allowed. |
654 | |
655 `:inherit' | |
656 | |
657 VALUE is the name of a face from which to inherit attributes, or a list | |
658 of face names. Attributes from inherited faces are merged into the face | |
659 like an underlying face would be, with higher priority than underlying faces." | |
31439
d7a98f35b441
(set-face-attribute): Simplify by calling
Gerd Moellmann <gerd@gnu.org>
parents:
31401
diff
changeset
|
660 (let ((where (if (null frame) 0 frame))) |
d7a98f35b441
(set-face-attribute): Simplify by calling
Gerd Moellmann <gerd@gnu.org>
parents:
31401
diff
changeset
|
661 (setq args (purecopy args)) |
51280
c2efaecb5d8f
(set-face-attribute): Set face-modified prop to t
Richard M. Stallman <rms@gnu.org>
parents:
51248
diff
changeset
|
662 ;; If we set the new-frame defaults, this face is modified outside Custom. |
c2efaecb5d8f
(set-face-attribute): Set face-modified prop to t
Richard M. Stallman <rms@gnu.org>
parents:
51248
diff
changeset
|
663 (if (memq where '(0 t)) |
c2efaecb5d8f
(set-face-attribute): Set face-modified prop to t
Richard M. Stallman <rms@gnu.org>
parents:
51248
diff
changeset
|
664 (put face 'face-modified t)) |
31439
d7a98f35b441
(set-face-attribute): Simplify by calling
Gerd Moellmann <gerd@gnu.org>
parents:
31401
diff
changeset
|
665 (while args |
d7a98f35b441
(set-face-attribute): Simplify by calling
Gerd Moellmann <gerd@gnu.org>
parents:
31401
diff
changeset
|
666 (internal-set-lisp-face-attribute face (car args) |
d7a98f35b441
(set-face-attribute): Simplify by calling
Gerd Moellmann <gerd@gnu.org>
parents:
31401
diff
changeset
|
667 (purecopy (cadr args)) |
d7a98f35b441
(set-face-attribute): Simplify by calling
Gerd Moellmann <gerd@gnu.org>
parents:
31401
diff
changeset
|
668 where) |
d7a98f35b441
(set-face-attribute): Simplify by calling
Gerd Moellmann <gerd@gnu.org>
parents:
31401
diff
changeset
|
669 (setq args (cdr (cdr args)))))) |
25012 | 670 |
671 | |
26337
6bf33b333eb2
(make-face-bold, make-face-unbold, make-face-italic)
Gerd Moellmann <gerd@gnu.org>
parents:
25947
diff
changeset
|
672 (defun make-face-bold (face &optional frame noerror) |
25012 | 673 "Make the font of FACE be bold, if possible. |
674 FRAME nil or not specified means change face on all frames. | |
26337
6bf33b333eb2
(make-face-bold, make-face-unbold, make-face-italic)
Gerd Moellmann <gerd@gnu.org>
parents:
25947
diff
changeset
|
675 Argument NOERROR is ignored and retained for compatibility. |
25012 | 676 Use `set-face-attribute' for finer control of the font weight." |
40456 | 677 (interactive (list (read-face-name "Make which face bold"))) |
25012 | 678 (set-face-attribute face frame :weight 'bold)) |
679 | |
680 | |
26337
6bf33b333eb2
(make-face-bold, make-face-unbold, make-face-italic)
Gerd Moellmann <gerd@gnu.org>
parents:
25947
diff
changeset
|
681 (defun make-face-unbold (face &optional frame noerror) |
25012 | 682 "Make the font of FACE be non-bold, if possible. |
26337
6bf33b333eb2
(make-face-bold, make-face-unbold, make-face-italic)
Gerd Moellmann <gerd@gnu.org>
parents:
25947
diff
changeset
|
683 FRAME nil or not specified means change face on all frames. |
6bf33b333eb2
(make-face-bold, make-face-unbold, make-face-italic)
Gerd Moellmann <gerd@gnu.org>
parents:
25947
diff
changeset
|
684 Argument NOERROR is ignored and retained for compatibility." |
40456 | 685 (interactive (list (read-face-name "Make which face non-bold"))) |
25012 | 686 (set-face-attribute face frame :weight 'normal)) |
687 | |
37943 | 688 |
26337
6bf33b333eb2
(make-face-bold, make-face-unbold, make-face-italic)
Gerd Moellmann <gerd@gnu.org>
parents:
25947
diff
changeset
|
689 (defun make-face-italic (face &optional frame noerror) |
25012 | 690 "Make the font of FACE be italic, if possible. |
691 FRAME nil or not specified means change face on all frames. | |
26337
6bf33b333eb2
(make-face-bold, make-face-unbold, make-face-italic)
Gerd Moellmann <gerd@gnu.org>
parents:
25947
diff
changeset
|
692 Argument NOERROR is ignored and retained for compatibility. |
25012 | 693 Use `set-face-attribute' for finer control of the font slant." |
40456 | 694 (interactive (list (read-face-name "Make which face italic"))) |
25012 | 695 (set-face-attribute face frame :slant 'italic)) |
696 | |
697 | |
26337
6bf33b333eb2
(make-face-bold, make-face-unbold, make-face-italic)
Gerd Moellmann <gerd@gnu.org>
parents:
25947
diff
changeset
|
698 (defun make-face-unitalic (face &optional frame noerror) |
25012 | 699 "Make the font of FACE be non-italic, if possible. |
28840 | 700 FRAME nil or not specified means change face on all frames. |
701 Argument NOERROR is ignored and retained for compatibility." | |
40456 | 702 (interactive (list (read-face-name "Make which face non-italic"))) |
25012 | 703 (set-face-attribute face frame :slant 'normal)) |
704 | |
37943 | 705 |
26337
6bf33b333eb2
(make-face-bold, make-face-unbold, make-face-italic)
Gerd Moellmann <gerd@gnu.org>
parents:
25947
diff
changeset
|
706 (defun make-face-bold-italic (face &optional frame noerror) |
25012 | 707 "Make the font of FACE be bold and italic, if possible. |
708 FRAME nil or not specified means change face on all frames. | |
26337
6bf33b333eb2
(make-face-bold, make-face-unbold, make-face-italic)
Gerd Moellmann <gerd@gnu.org>
parents:
25947
diff
changeset
|
709 Argument NOERROR is ignored and retained for compatibility. |
25012 | 710 Use `set-face-attribute' for finer control of font weight and slant." |
40456 | 711 (interactive (list (read-face-name "Make which face bold-italic"))) |
25012 | 712 (set-face-attribute face frame :weight 'bold :slant 'italic)) |
713 | |
714 | |
715 (defun set-face-font (face font &optional frame) | |
716 "Change font-related attributes of FACE to those of FONT (a string). | |
717 FRAME nil or not specified means change face on all frames. | |
718 This sets the attributes `:family', `:width', `:height', `:weight', | |
719 and `:slant'. When called interactively, prompt for the face and font." | |
720 (interactive (read-face-and-attribute :font)) | |
721 (set-face-attribute face frame :font font)) | |
722 | |
723 | |
724 ;; Implementation note: Emulating gray background colors with a | |
725 ;; stipple pattern is now part of the face realization process, and is | |
726 ;; done in C depending on the frame on which the face is realized. | |
727 | |
728 (defun set-face-background (face color &optional frame) | |
729 "Change the background color of face FACE to COLOR (a string). | |
730 FRAME nil or not specified means change face on all frames. | |
59281
95516eef1d5b
(set-face-background, set-face-foreground): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
59262
diff
changeset
|
731 COLOR can be a system-defined color name (see `list-colors-display') |
95516eef1d5b
(set-face-background, set-face-foreground): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
59262
diff
changeset
|
732 or a hex spec of the form #RRGGBB. |
95516eef1d5b
(set-face-background, set-face-foreground): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
59262
diff
changeset
|
733 When called interactively, prompts for the face and color." |
25012 | 734 (interactive (read-face-and-attribute :background)) |
36060
d9b4d1370073
(set-face-background, set-face-foreground)
Miles Bader <miles@gnu.org>
parents:
36035
diff
changeset
|
735 (set-face-attribute face frame :background (or color 'unspecified))) |
25012 | 736 |
737 | |
738 (defun set-face-foreground (face color &optional frame) | |
739 "Change the foreground color of face FACE to COLOR (a string). | |
740 FRAME nil or not specified means change face on all frames. | |
59281
95516eef1d5b
(set-face-background, set-face-foreground): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
59262
diff
changeset
|
741 COLOR can be a system-defined color name (see `list-colors-display') |
95516eef1d5b
(set-face-background, set-face-foreground): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
59262
diff
changeset
|
742 or a hex spec of the form #RRGGBB. |
95516eef1d5b
(set-face-background, set-face-foreground): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
59262
diff
changeset
|
743 When called interactively, prompts for the face and color." |
25012 | 744 (interactive (read-face-and-attribute :foreground)) |
36060
d9b4d1370073
(set-face-background, set-face-foreground)
Miles Bader <miles@gnu.org>
parents:
36035
diff
changeset
|
745 (set-face-attribute face frame :foreground (or color 'unspecified))) |
25012 | 746 |
747 | |
748 (defun set-face-stipple (face stipple &optional frame) | |
749 "Change the stipple pixmap of face FACE to STIPPLE. | |
750 FRAME nil or not specified means change face on all frames. | |
28840 | 751 STIPPLE should be a string, the name of a file of pixmap data. |
25012 | 752 The directories listed in the `x-bitmap-file-path' variable are searched. |
753 | |
754 Alternatively, STIPPLE may be a list of the form (WIDTH HEIGHT DATA) | |
755 where WIDTH and HEIGHT are the size in pixels, | |
756 and DATA is a string, containing the raw bits of the bitmap." | |
757 (interactive (read-face-and-attribute :stipple)) | |
36060
d9b4d1370073
(set-face-background, set-face-foreground)
Miles Bader <miles@gnu.org>
parents:
36035
diff
changeset
|
758 (set-face-attribute face frame :stipple (or stipple 'unspecified))) |
25012 | 759 |
760 | |
761 (defun set-face-underline (face underline &optional frame) | |
762 "Specify whether face FACE is underlined. | |
763 UNDERLINE nil means FACE explicitly doesn't underline. | |
764 UNDERLINE non-nil means FACE explicitly does underlining | |
765 with the same of the foreground color. | |
766 If UNDERLINE is a string, underline with the color named UNDERLINE. | |
767 FRAME nil or not specified means change face on all frames. | |
768 Use `set-face-attribute' to ``unspecify'' underlining." | |
769 (interactive | |
770 (let ((list (read-face-and-attribute :underline))) | |
771 (list (car list) (eq (car (cdr list)) t)))) | |
772 (set-face-attribute face frame :underline underline)) | |
773 | |
774 | |
775 (defun set-face-underline-p (face underline-p &optional frame) | |
776 "Specify whether face FACE is underlined. | |
777 UNDERLINE-P nil means FACE explicitly doesn't underline. | |
778 UNDERLINE-P non-nil means FACE explicitly does underlining. | |
779 FRAME nil or not specified means change face on all frames. | |
780 Use `set-face-attribute' to ``unspecify'' underlining." | |
781 (interactive | |
782 (let ((list (read-face-and-attribute :underline))) | |
783 (list (car list) (eq (car (cdr list)) t)))) | |
784 (set-face-attribute face frame :underline underline-p)) | |
785 | |
786 | |
787 (defun set-face-inverse-video-p (face inverse-video-p &optional frame) | |
788 "Specify whether face FACE is in inverse video. | |
789 INVERSE-VIDEO-P non-nil means FACE displays explicitly in inverse video. | |
790 INVERSE-VIDEO-P nil means FACE explicitly is not in inverse video. | |
791 FRAME nil or not specified means change face on all frames. | |
792 Use `set-face-attribute' to ``unspecify'' the inverse video attribute." | |
793 (interactive | |
794 (let ((list (read-face-and-attribute :inverse-video))) | |
795 (list (car list) (eq (car (cdr list)) t)))) | |
796 (set-face-attribute face frame :inverse-video inverse-video-p)) | |
797 | |
798 | |
799 (defun set-face-bold-p (face bold-p &optional frame) | |
800 "Specify whether face FACE is bold. | |
801 BOLD-P non-nil means FACE should explicitly display bold. | |
802 BOLD-P nil means FACE should explicitly display non-bold. | |
803 FRAME nil or not specified means change face on all frames. | |
804 Use `set-face-attribute' or `modify-face' for finer control." | |
805 (if (null bold-p) | |
806 (make-face-unbold face frame) | |
807 (make-face-bold face frame))) | |
808 | |
809 | |
810 (defun set-face-italic-p (face italic-p &optional frame) | |
811 "Specify whether face FACE is italic. | |
812 ITALIC-P non-nil means FACE should explicitly display italic. | |
813 ITALIC-P nil means FACE should explicitly display non-italic. | |
814 FRAME nil or not specified means change face on all frames. | |
815 Use `set-face-attribute' or `modify-face' for finer control." | |
816 (if (null italic-p) | |
817 (make-face-unitalic face frame) | |
818 (make-face-italic face frame))) | |
819 | |
820 | |
821 (defalias 'set-face-background-pixmap 'set-face-stipple) | |
10379
f9d713e8c77c
(face-nontrivial-p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
10375
diff
changeset
|
822 |
2456 | 823 |
824 (defun invert-face (face &optional frame) | |
25012 | 825 "Swap the foreground and background colors of FACE. |
40454
ce83eda9592d
(invert-face): Check for 'unspecified, not for nil,
Eli Zaretskii <eliz@gnu.org>
parents:
40399
diff
changeset
|
826 If FRAME is omitted or nil, it means change face on all frames. |
25012 | 827 If FACE specifies neither foreground nor background color, |
828 set its foreground and background to the background and foreground | |
829 of the default face. Value is FACE." | |
40456 | 830 (interactive (list (read-face-name "Invert face"))) |
25012 | 831 (let ((fg (face-attribute face :foreground frame)) |
832 (bg (face-attribute face :background frame))) | |
40454
ce83eda9592d
(invert-face): Check for 'unspecified, not for nil,
Eli Zaretskii <eliz@gnu.org>
parents:
40399
diff
changeset
|
833 (if (not (and (eq fg 'unspecified) (eq bg 'unspecified))) |
25012 | 834 (set-face-attribute face frame :foreground bg :background fg) |
835 (set-face-attribute face frame | |
836 :foreground | |
837 (face-attribute 'default :background frame) | |
838 :background | |
839 (face-attribute 'default :foreground frame)))) | |
2456 | 840 face) |
841 | |
25012 | 842 |
843 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
844 ;;; Interactively modifying faces. | |
845 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2456 | 846 |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
847 (defun read-face-name (prompt &optional string-describing-default multiple) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
848 "Read a face, defaulting to the face or faces on the char after point. |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
849 If it has a `read-face-name' property, that overrides the `face' property. |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
850 PROMPT describes what you will do with the face (don't end in a space). |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
851 STRING-DESCRIBING-DEFAULT describes what default you will use |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
852 if this function returns nil. |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
853 If MULTIPLE is non-nil, return a list of faces (possibly only one). |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
854 Otherwise, return a single face." |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
855 (let ((faceprop (or (get-char-property (point) 'read-face-name) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
856 (get-char-property (point) 'face))) |
63382
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
857 (aliasfaces nil) |
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
858 (nonaliasfaces nil) |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
859 faces) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
860 ;; Make a list of the named faces that the `face' property uses. |
59262
c9bf2e1b7e1a
(read-face-name): Don't treat an attribute spec as a list of faces.
Richard M. Stallman <rms@gnu.org>
parents:
59077
diff
changeset
|
861 (if (and (listp faceprop) |
c9bf2e1b7e1a
(read-face-name): Don't treat an attribute spec as a list of faces.
Richard M. Stallman <rms@gnu.org>
parents:
59077
diff
changeset
|
862 ;; Don't treat an attribute spec as a list of faces. |
c9bf2e1b7e1a
(read-face-name): Don't treat an attribute spec as a list of faces.
Richard M. Stallman <rms@gnu.org>
parents:
59077
diff
changeset
|
863 (not (keywordp (car faceprop))) |
c9bf2e1b7e1a
(read-face-name): Don't treat an attribute spec as a list of faces.
Richard M. Stallman <rms@gnu.org>
parents:
59077
diff
changeset
|
864 (not (memq (car faceprop) '(foreground-color background-color)))) |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
865 (dolist (f faceprop) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
866 (if (symbolp f) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
867 (push f faces))) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
868 (if (symbolp faceprop) |
59262
c9bf2e1b7e1a
(read-face-name): Don't treat an attribute spec as a list of faces.
Richard M. Stallman <rms@gnu.org>
parents:
59077
diff
changeset
|
869 (push faceprop faces))) |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
870 ;; If there are none, try to get a face name from the buffer. |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
871 (if (and (null faces) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
872 (memq (intern-soft (thing-at-point 'symbol)) (face-list))) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
873 (setq faces (list (intern-soft (thing-at-point 'symbol))))) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
874 |
63382
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
875 ;; Build up the completion tables. |
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
876 (mapatoms (lambda (s) |
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
877 (if (custom-facep s) |
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
878 (if (get s 'face-alias) |
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
879 (push (symbol-name s) aliasfaces) |
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
880 (push (symbol-name s) nonaliasfaces))))) |
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
881 |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
882 ;; If we only want one, and the default is more than one, |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
883 ;; discard the unwanted ones now. |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
884 (unless multiple |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
885 (if faces |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
886 (setq faces (list (car faces))))) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
887 (let* ((input |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
888 ;; Read the input. |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
889 (completing-read |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
890 (if (or faces string-describing-default) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
891 (format "%s (default %s): " prompt |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
892 (if faces (mapconcat 'symbol-name faces ", ") |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
893 string-describing-default)) |
44896
fc1fdc78c3eb
(read-face-name): Format the prompt correctly when there's no default.
Miles Bader <miles@gnu.org>
parents:
44892
diff
changeset
|
894 (format "%s: " prompt)) |
63382
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
895 (complete-in-turn nonaliasfaces aliasfaces) nil t)) |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
896 ;; Canonicalize the output. |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
897 (output |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
898 (if (equal input "") |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
899 faces |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
900 (if (stringp input) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
901 (list (intern input)) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
902 input)))) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
903 ;; Return either a list of faces or just one face. |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
904 (if multiple |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
905 output |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
906 (car output))))) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
907 |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
908 |
25012 | 909 (defun face-valid-attribute-values (attribute &optional frame) |
910 "Return valid values for face attribute ATTRIBUTE. | |
911 The optional argument FRAME is used to determine available fonts | |
912 and colors. If it is nil or not specified, the selected frame is | |
913 used. Value is an alist of (NAME . VALUE) if ATTRIBUTE expects a value | |
914 out of a set of discrete values. Value is `integerp' if ATTRIBUTE expects | |
915 an integer value." | |
37943 | 916 (let ((valid |
917 (case attribute | |
918 (:family | |
919 (if window-system | |
920 (mapcar #'(lambda (x) (cons (car x) (car x))) | |
921 (x-font-family-list)) | |
922 ;; Only one font on TTYs. | |
923 (list (cons "default" "default")))) | |
924 ((:width :weight :slant :inverse-video) | |
925 (mapcar #'(lambda (x) (cons (symbol-name x) x)) | |
926 (internal-lisp-face-attribute-values attribute))) | |
927 ((:underline :overline :strike-through :box) | |
928 (if window-system | |
929 (nconc (mapcar #'(lambda (x) (cons (symbol-name x) x)) | |
930 (internal-lisp-face-attribute-values attribute)) | |
931 (mapcar #'(lambda (c) (cons c c)) | |
932 (x-defined-colors frame))) | |
933 (mapcar #'(lambda (x) (cons (symbol-name x) x)) | |
934 (internal-lisp-face-attribute-values attribute)))) | |
935 ((:foreground :background) | |
936 (mapcar #'(lambda (c) (cons c c)) | |
937 (defined-colors frame))) | |
938 ((:height) | |
939 'integerp) | |
940 (:stipple | |
941 (and (memq window-system '(x w32 mac)) | |
942 (mapcar #'list | |
943 (apply #'nconc | |
944 (mapcar (lambda (dir) | |
945 (and (file-readable-p dir) | |
946 (file-directory-p dir) | |
947 (directory-files dir))) | |
948 x-bitmap-file-path))))) | |
949 (:inherit | |
950 (cons '("none" . nil) | |
951 (mapcar #'(lambda (c) (cons (symbol-name c) c)) | |
952 (face-list)))) | |
953 (t | |
954 (error "Internal error"))))) | |
31190 | 955 (if (and (listp valid) (not (memq attribute '(:inherit)))) |
25245
ef080d2576f9
(face-valid-attribute-values): Return an alist for
Gerd Moellmann <gerd@gnu.org>
parents:
25210
diff
changeset
|
956 (nconc (list (cons "unspecified" 'unspecified)) valid) |
ef080d2576f9
(face-valid-attribute-values): Return an alist for
Gerd Moellmann <gerd@gnu.org>
parents:
25210
diff
changeset
|
957 valid))) |
25012 | 958 |
959 | |
960 (defvar face-attribute-name-alist | |
961 '((:family . "font family") | |
962 (:width . "character set width") | |
963 (:height . "height in 1/10 pt") | |
964 (:weight . "weight") | |
965 (:slant . "slant") | |
966 (:underline . "underline") | |
967 (:overline . "overline") | |
968 (:strike-through . "strike-through") | |
969 (:box . "box") | |
970 (:inverse-video . "inverse-video display") | |
971 (:foreground . "foreground color") | |
972 (:background . "background color") | |
31190 | 973 (:stipple . "background stipple") |
974 (:inherit . "inheritance")) | |
25012 | 975 "An alist of descriptive names for face attributes. |
976 Each element has the form (ATTRIBUTE-NAME . DESCRIPTION) where | |
977 ATTRIBUTE-NAME is a face attribute name (a keyword symbol), and | |
978 DESCRIPTION is a descriptive name for ATTRIBUTE-NAME.") | |
979 | |
980 | |
981 (defun face-descriptive-attribute-name (attribute) | |
982 "Return a descriptive name for ATTRIBUTE." | |
983 (cdr (assq attribute face-attribute-name-alist))) | |
984 | |
985 | |
986 (defun face-read-string (face default name &optional completion-alist) | |
987 "Interactively read a face attribute string value. | |
31190 | 988 FACE is the face whose attribute is read. If non-nil, DEFAULT is the |
989 default string to return if no new value is entered. NAME is a | |
990 descriptive name of the attribute for prompting. COMPLETION-ALIST is an | |
991 alist of valid values, if non-nil. | |
25012 | 992 |
31190 | 993 Entering nothing accepts the default string DEFAULT. |
25012 | 994 Value is the new attribute value." |
31190 | 995 ;; Capitalize NAME (we don't use `capitalize' because that capitalizes |
996 ;; each word in a string separately). | |
997 (setq name (concat (upcase (substring name 0 1)) (substring name 1))) | |
25012 | 998 (let* ((completion-ignore-case t) |
999 (value (completing-read | |
1000 (if default | |
31190 | 1001 (format "%s for face `%s' (default %s): " |
1002 name face default) | |
1003 (format "%s for face `%s': " name face)) | |
25012 | 1004 completion-alist))) |
25245
ef080d2576f9
(face-valid-attribute-values): Return an alist for
Gerd Moellmann <gerd@gnu.org>
parents:
25210
diff
changeset
|
1005 (if (equal value "") default value))) |
25012 | 1006 |
1007 | |
1008 (defun face-read-integer (face default name) | |
1009 "Interactively read an integer face attribute value. | |
1010 FACE is the face whose attribute is read. DEFAULT is the default | |
1011 value to return if no new value is entered. NAME is a descriptive | |
1012 name of the attribute for prompting. Value is the new attribute value." | |
25245
ef080d2576f9
(face-valid-attribute-values): Return an alist for
Gerd Moellmann <gerd@gnu.org>
parents:
25210
diff
changeset
|
1013 (let ((new-value |
ef080d2576f9
(face-valid-attribute-values): Return an alist for
Gerd Moellmann <gerd@gnu.org>
parents:
25210
diff
changeset
|
1014 (face-read-string face |
31190 | 1015 (format "%s" default) |
25245
ef080d2576f9
(face-valid-attribute-values): Return an alist for
Gerd Moellmann <gerd@gnu.org>
parents:
25210
diff
changeset
|
1016 name |
ef080d2576f9
(face-valid-attribute-values): Return an alist for
Gerd Moellmann <gerd@gnu.org>
parents:
25210
diff
changeset
|
1017 (list (cons "unspecified" 'unspecified))))) |
31190 | 1018 (cond ((equal new-value "unspecified") |
1019 'unspecified) | |
1020 ((member new-value '("unspecified-fg" "unspecified-bg")) | |
1021 new-value) | |
1022 (t | |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
62386
diff
changeset
|
1023 (string-to-number new-value))))) |
25012 | 1024 |
1025 | |
1026 (defun read-face-attribute (face attribute &optional frame) | |
1027 "Interactively read a new value for FACE's ATTRIBUTE. | |
1028 Optional argument FRAME nil or unspecified means read an attribute value | |
1029 of a global face. Value is the new attribute value." | |
1030 (let* ((old-value (face-attribute face attribute frame)) | |
1031 (attribute-name (face-descriptive-attribute-name attribute)) | |
1032 (valid (face-valid-attribute-values attribute frame)) | |
1033 new-value) | |
1034 ;; Represent complex attribute values as strings by printing them | |
1035 ;; out. Stipple can be a vector; (WIDTH HEIGHT DATA). Box can be | |
1036 ;; a list `(:width WIDTH :color COLOR)' or `(:width WIDTH :shadow | |
1037 ;; SHADOW)'. | |
1038 (when (and (or (eq attribute :stipple) | |
1039 (eq attribute :box)) | |
1040 (or (consp old-value) | |
1041 (vectorp old-value))) | |
1042 (setq old-value (prin1-to-string old-value))) | |
1043 (cond ((listp valid) | |
31190 | 1044 (let ((default |
1045 (or (car (rassoc old-value valid)) | |
1046 (format "%s" old-value)))) | |
1047 (setq new-value | |
1048 (face-read-string face default attribute-name valid)) | |
1049 (if (equal new-value default) | |
1050 ;; Nothing changed, so don't bother with all the stuff | |
1051 ;; below. In particular, this avoids a non-tty color | |
1052 ;; from being canonicalized for a tty when the user | |
1053 ;; just uses the default. | |
1054 (setq new-value old-value) | |
1055 ;; Terminal frames can support colors that don't appear | |
1056 ;; explicitly in VALID, using color approximation code | |
1057 ;; in tty-colors.el. | |
34585
1e66e14d9695
(read-face-attribute): If there's no entry for the user's input in
Miles Bader <miles@gnu.org>
parents:
34246
diff
changeset
|
1058 (when (and (memq attribute '(:foreground :background)) |
1e66e14d9695
(read-face-attribute): If there's no entry for the user's input in
Miles Bader <miles@gnu.org>
parents:
34246
diff
changeset
|
1059 (not (memq window-system '(x w32 mac))) |
1e66e14d9695
(read-face-attribute): If there's no entry for the user's input in
Miles Bader <miles@gnu.org>
parents:
34246
diff
changeset
|
1060 (not (member new-value |
1e66e14d9695
(read-face-attribute): If there's no entry for the user's input in
Miles Bader <miles@gnu.org>
parents:
34246
diff
changeset
|
1061 '("unspecified" |
1e66e14d9695
(read-face-attribute): If there's no entry for the user's input in
Miles Bader <miles@gnu.org>
parents:
34246
diff
changeset
|
1062 "unspecified-fg" "unspecified-bg")))) |
34587 | 1063 (setq new-value (car (tty-color-desc new-value frame)))) |
34585
1e66e14d9695
(read-face-attribute): If there's no entry for the user's input in
Miles Bader <miles@gnu.org>
parents:
34246
diff
changeset
|
1064 (when (assoc new-value valid) |
1e66e14d9695
(read-face-attribute): If there's no entry for the user's input in
Miles Bader <miles@gnu.org>
parents:
34246
diff
changeset
|
1065 (setq new-value (cdr (assoc new-value valid))))))) |
25012 | 1066 ((eq valid 'integerp) |
1067 (setq new-value (face-read-integer face old-value attribute-name))) | |
1068 (t (error "Internal error"))) | |
1069 ;; Convert stipple and box value text we read back to a list or | |
1070 ;; vector if it looks like one. This makes the assumption that a | |
1071 ;; pixmap file name won't start with an open-paren. | |
1072 (when (and (or (eq attribute :stipple) | |
1073 (eq attribute :box)) | |
1074 (stringp new-value) | |
1075 (string-match "^[[(]" new-value)) | |
1076 (setq new-value (read new-value))) | |
1077 new-value)) | |
1078 | |
1079 | |
1080 (defun read-face-font (face &optional frame) | |
1081 "Read the name of a font for FACE on FRAME. | |
1082 If optional argument FRAME Is nil or omitted, use the selected frame." | |
1083 (let ((completion-ignore-case t)) | |
31197
39d437913f44
(read-face-font, read-face-and-attribute): Tweak prompts.
Miles Bader <miles@gnu.org>
parents:
31193
diff
changeset
|
1084 (completing-read (format "Set font attributes of face `%s' from font: " face) |
54574
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1085 (x-list-fonts "*" nil frame)))) |
25012 | 1086 |
1087 | |
1088 (defun read-all-face-attributes (face &optional frame) | |
1089 "Interactively read all attributes for FACE. | |
1090 If optional argument FRAME Is nil or omitted, use the selected frame. | |
1091 Value is a property list of attribute names and new values." | |
1092 (let (result) | |
1093 (dolist (attribute face-attribute-name-alist result) | |
1094 (setq result (cons (car attribute) | |
1095 (cons (read-face-attribute face (car attribute) frame) | |
1096 result)))))) | |
1097 | |
37467
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1098 (defun modify-face (&optional face foreground background stipple |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1099 bold-p italic-p underline-p inverse-p frame) |
25012 | 1100 "Modify attributes of faces interactively. |
1101 If optional argument FRAME is nil or omitted, modify the face used | |
37467
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1102 for newly created frame, i.e. the global face. |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1103 For non-interactive use, `set-face-attribute' is preferred. |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1104 When called from elisp, if FACE is nil, all arguments but FRAME are ignored |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1105 and the face and its settings are obtained by querying the user." |
25012 | 1106 (interactive) |
37467
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1107 (if face |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1108 (set-face-attribute face frame |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1109 :foreground (or foreground 'unspecified) |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1110 :background (or background 'unspecified) |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1111 :stipple stipple |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1112 :bold bold-p |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1113 :italic italic-p |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1114 :underline underline-p |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1115 :inverse-video inverse-p) |
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1116 (setq face (read-face-name "Modify face")) |
25012 | 1117 (apply #'set-face-attribute face frame |
1118 (read-all-face-attributes face frame)))) | |
1119 | |
1120 (defun read-face-and-attribute (attribute &optional frame) | |
1121 "Read face name and face attribute value. | |
1122 ATTRIBUTE is the attribute whose new value is read. | |
1123 FRAME nil or unspecified means read attribute value of global face. | |
1124 Value is a list (FACE NEW-VALUE) where FACE is the face read | |
37467
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1125 \(a symbol), and NEW-VALUE is value read." |
25012 | 1126 (cond ((eq attribute :font) |
31197
39d437913f44
(read-face-font, read-face-and-attribute): Tweak prompts.
Miles Bader <miles@gnu.org>
parents:
31193
diff
changeset
|
1127 (let* ((prompt "Set font-related attributes of face") |
25012 | 1128 (face (read-face-name prompt)) |
1129 (font (read-face-font face frame))) | |
1130 (list face font))) | |
1131 (t | |
1132 (let* ((attribute-name (face-descriptive-attribute-name attribute)) | |
31190 | 1133 (prompt (format "Set %s of face" attribute-name)) |
25012 | 1134 (face (read-face-name prompt)) |
1135 (new-value (read-face-attribute face attribute frame))) | |
1136 (list face new-value))))) | |
1137 | |
1138 | |
1139 | |
1140 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1141 ;;; Listing faces. | |
1142 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1143 | |
1144 (defvar list-faces-sample-text | |
1145 "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
1146 "*Text string to display as the sample text for `list-faces-display'.") | |
1147 | |
1148 | |
1149 ;; The name list-faces would be more consistent, but let's avoid a | |
1150 ;; conflict with Lucid, which uses that name differently. | |
1151 | |
48914
bb52f186fa1e
(help-xref-stack): Add defvar to avoid warning.
Richard M. Stallman <rms@gnu.org>
parents:
48713
diff
changeset
|
1152 (defvar help-xref-stack) |
59872
d7da3e10bfef
(list-faces-display): Add optional argument.
Richard M. Stallman <rms@gnu.org>
parents:
59281
diff
changeset
|
1153 (defun list-faces-display (&optional regexp) |
25012 | 1154 "List all faces, using the same sample text in each. |
1155 The sample text is a string that comes from the variable | |
59872
d7da3e10bfef
(list-faces-display): Add optional argument.
Richard M. Stallman <rms@gnu.org>
parents:
59281
diff
changeset
|
1156 `list-faces-sample-text'. |
d7da3e10bfef
(list-faces-display): Add optional argument.
Richard M. Stallman <rms@gnu.org>
parents:
59281
diff
changeset
|
1157 |
d7da3e10bfef
(list-faces-display): Add optional argument.
Richard M. Stallman <rms@gnu.org>
parents:
59281
diff
changeset
|
1158 If REGEXP is non-nil, list only those faces with names matching |
d7da3e10bfef
(list-faces-display): Add optional argument.
Richard M. Stallman <rms@gnu.org>
parents:
59281
diff
changeset
|
1159 this regular expression. When called interactively with a prefix |
d7da3e10bfef
(list-faces-display): Add optional argument.
Richard M. Stallman <rms@gnu.org>
parents:
59281
diff
changeset
|
1160 arg, prompt for a regular expression." |
d7da3e10bfef
(list-faces-display): Add optional argument.
Richard M. Stallman <rms@gnu.org>
parents:
59281
diff
changeset
|
1161 (interactive (list (and current-prefix-arg |
d7da3e10bfef
(list-faces-display): Add optional argument.
Richard M. Stallman <rms@gnu.org>
parents:
59281
diff
changeset
|
1162 (read-string "List faces matching regexp: ")))) |
62947
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1163 (let ((all-faces (zerop (length regexp))) |
25012 | 1164 (frame (selected-frame)) |
62947
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1165 (max-length 0) |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1166 faces line-format |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1167 disp-frame window face-name) |
62947
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1168 ;; We filter and take the max length in one pass |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1169 (setq faces |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1170 (delq nil |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1171 (mapcar (lambda (f) |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1172 (let ((s (symbol-name f))) |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1173 (when (or all-faces (string-match regexp s)) |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1174 (setq max-length (max (length s) max-length)) |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1175 f))) |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1176 (sort (face-list) #'string-lessp)))) |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1177 (unless faces |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1178 (error "No faces matching \"%s\"" regexp)) |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1179 (setq max-length (1+ max-length) |
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1180 line-format (format "%%-%ds" max-length)) |
25012 | 1181 (with-output-to-temp-buffer "*Faces*" |
1182 (save-excursion | |
1183 (set-buffer standard-output) | |
1184 (setq truncate-lines t) | |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1185 (insert |
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1186 (substitute-command-keys |
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1187 (concat |
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1188 "Use " |
27736
b4d0a1247b35
(list-faces-display): Use display-mouse-p, not window-system.
Eli Zaretskii <eliz@gnu.org>
parents:
27716
diff
changeset
|
1189 (if (display-mouse-p) "\\[help-follow-mouse] or ") |
27831
05cce359cbf0
(list-faces-display): Fix header typo.
Dave Love <fx@gnu.org>
parents:
27736
diff
changeset
|
1190 "\\[help-follow] on a face name to customize it\n" |
43550
fc7733c201af
(list-faces-display): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
43392
diff
changeset
|
1191 "or on its sample text for a description of the face.\n\n"))) |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1192 (setq help-xref-stack nil) |
59872
d7da3e10bfef
(list-faces-display): Add optional argument.
Richard M. Stallman <rms@gnu.org>
parents:
59281
diff
changeset
|
1193 (dolist (face faces) |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1194 (setq face-name (symbol-name face)) |
62947
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1195 (insert (format line-format face-name)) |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1196 ;; Hyperlink to a customization buffer for the face. Using |
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1197 ;; the help xref mechanism may not be the best way. |
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1198 (save-excursion |
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1199 (save-match-data |
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1200 (search-backward face-name) |
62534
bf6a0cd0e835
(list-faces-display): Make back button respect optional regexp arg.
Nick Roberts <nickrob@snap.net.nz>
parents:
62498
diff
changeset
|
1201 (setq help-xref-stack-item `(list-faces-display ,regexp)) |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1202 (help-xref-button 0 'help-customize-face face))) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1203 (let ((beg (point)) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1204 (line-beg (line-beginning-position))) |
25012 | 1205 (insert list-faces-sample-text) |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1206 ;; Hyperlink to a help buffer for the face. |
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1207 (save-excursion |
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1208 (save-match-data |
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1209 (search-backward list-faces-sample-text) |
39799
99f30ac48ec0
(list-faces-display, describe-face): Fix args to `help-xref-button'.
Miles Bader <miles@gnu.org>
parents:
39549
diff
changeset
|
1210 (help-xref-button 0 'help-face face))) |
25012 | 1211 (insert "\n") |
1212 (put-text-property beg (1- (point)) 'face face) | |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1213 ;; Make all face commands default to the proper face |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1214 ;; anywhere in the line. |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1215 (put-text-property line-beg (1- (point)) 'read-face-name face) |
25012 | 1216 ;; If the sample text has multiple lines, line up all of them. |
1217 (goto-char beg) | |
1218 (forward-line 1) | |
1219 (while (not (eobp)) | |
62947
2a5dbdf6d22a
(list-faces-display): Improve the formatting by computing the maximum length
Juanma Barranquero <lekktu@gmail.com>
parents:
62922
diff
changeset
|
1220 (insert-char ?\s max-length) |
25012 | 1221 (forward-line 1)))) |
1222 (goto-char (point-min))) | |
1223 (print-help-return-message)) | |
1224 ;; If the *Faces* buffer appears in a different frame, | |
1225 ;; copy all the face definitions from FRAME, | |
1226 ;; so that the display will reflect the frame that was selected. | |
1227 (setq window (get-buffer-window (get-buffer "*Faces*") t)) | |
1228 (setq disp-frame (if window (window-frame window) | |
1229 (car (frame-list)))) | |
1230 (or (eq frame disp-frame) | |
1231 (let ((faces (face-list))) | |
1232 (while faces | |
1233 (copy-face (car faces) (car faces) frame disp-frame) | |
1234 (setq faces (cdr faces))))))) | |
1235 | |
59872
d7da3e10bfef
(list-faces-display): Add optional argument.
Richard M. Stallman <rms@gnu.org>
parents:
59281
diff
changeset
|
1236 |
25012 | 1237 (defun describe-face (face &optional frame) |
1238 "Display the properties of face FACE on FRAME. | |
45314
d752ae89321a
(describe-face): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
45255
diff
changeset
|
1239 Interactively, FACE defaults to the faces of the character after point |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1240 and FRAME defaults to the selected frame. |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1241 |
25012 | 1242 If the optional argument FRAME is given, report on face FACE in that frame. |
1243 If FRAME is t, report on the defaults for face FACE (for new frames). | |
1244 If FRAME is omitted or nil, use the selected frame." | |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1245 (interactive (list (read-face-name "Describe face" "= `default' face" t))) |
25012 | 1246 (let* ((attrs '((:family . "Family") |
1247 (:width . "Width") | |
1248 (:height . "Height") | |
1249 (:weight . "Weight") | |
1250 (:slant . "Slant") | |
1251 (:foreground . "Foreground") | |
1252 (:background . "Background") | |
1253 (:underline . "Underline") | |
1254 (:overline . "Overline") | |
1255 (:strike-through . "Strike-through") | |
1256 (:box . "Box") | |
1257 (:inverse-video . "Inverse") | |
28214
73c16c6e401e
(read-face-font): Fix TABLE arg to completing-read.
Kenichi Handa <handa@m17n.org>
parents:
27928
diff
changeset
|
1258 (:stipple . "Stipple") |
31179
354c781f2864
(describe-face): Add support for :inherit attribute.
Miles Bader <miles@gnu.org>
parents:
30971
diff
changeset
|
1259 (:font . "Font or fontset") |
354c781f2864
(describe-face): Add support for :inherit attribute.
Miles Bader <miles@gnu.org>
parents:
30971
diff
changeset
|
1260 (:inherit . "Inherit"))) |
25012 | 1261 (max-width (apply #'max (mapcar #'(lambda (x) (length (cdr x))) |
1262 attrs)))) | |
39830
aed9c3afb7ed
(describe-face): Call help-setup-xref earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39799
diff
changeset
|
1263 (help-setup-xref (list #'describe-face face) (interactive-p)) |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1264 (unless face |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1265 (setq face 'default)) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1266 (if (not (listp face)) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1267 (setq face (list face))) |
39799
99f30ac48ec0
(list-faces-display, describe-face): Fix args to `help-xref-button'.
Miles Bader <miles@gnu.org>
parents:
39549
diff
changeset
|
1268 (with-output-to-temp-buffer (help-buffer) |
25012 | 1269 (save-excursion |
1270 (set-buffer standard-output) | |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1271 (dolist (f face) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1272 (insert "Face: " (symbol-name f)) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1273 (if (not (facep f)) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1274 (insert " undefined face.\n") |
62386
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1275 (let ((customize-label "customize this face") |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1276 file-name) |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1277 (princ (concat " (" customize-label ")\n")) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1278 (insert "Documentation: " |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1279 (or (face-documentation f) |
46041
53b3233b2574
(describe-face): Capitalize "not documented" message.
Juanma Barranquero <lekktu@gmail.com>
parents:
45722
diff
changeset
|
1280 "Not documented as a face.") |
62386
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1281 "\n") |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1282 (with-current-buffer standard-output |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1283 (save-excursion |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1284 (re-search-backward |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1285 (concat "\\(" customize-label "\\)") nil t) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1286 (help-xref-button 1 'help-customize-face f))) |
62386
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1287 ;; The next 4 sexps are copied from describe-function-1 |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1288 ;; and simplified. |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1289 (setq file-name (symbol-file f 'defface)) |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1290 (when file-name |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1291 (princ "Defined in `") |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1292 (princ file-name) |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1293 (princ "'") |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1294 ;; Make a hyperlink to the library. |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1295 (save-excursion |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1296 (re-search-backward "`\\([^`']+\\)'" nil t) |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1297 (help-xref-button 1 'help-face-def f file-name)) |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1298 (princ ".") |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1299 (terpri) |
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
1300 (terpri)) |
44886
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1301 (dolist (a attrs) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1302 (let ((attr (face-attribute f (car a) frame))) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1303 (insert (make-string (- max-width (length (cdr a))) ?\ ) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1304 (cdr a) ": " (format "%s" attr) "\n"))))) |
fe167023fdf0
(read-face-name): New defaulting features.
Richard M. Stallman <rms@gnu.org>
parents:
44590
diff
changeset
|
1305 (terpri))) |
39830
aed9c3afb7ed
(describe-face): Call help-setup-xref earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39799
diff
changeset
|
1306 (print-help-return-message)))) |
39799
99f30ac48ec0
(list-faces-display, describe-face): Fix args to `help-xref-button'.
Miles Bader <miles@gnu.org>
parents:
39549
diff
changeset
|
1307 |
2456 | 1308 |
25012 | 1309 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1310 ;;; Face specifications (defface). | |
1311 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1312 | |
1313 ;; Parameter FRAME Is kept for call compatibility to with previous | |
1314 ;; face implementation. | |
1315 | |
1316 (defun face-attr-construct (face &optional frame) | |
1317 "Return a defface-style attribute list for FACE on FRAME. | |
1318 Value is a property list of pairs ATTRIBUTE VALUE for all specified | |
1319 face attributes of FACE where ATTRIBUTE is the attribute name and | |
1320 VALUE is the specified value of that attribute." | |
1321 (let (result) | |
1322 (dolist (entry face-attribute-name-alist result) | |
1323 (let* ((attribute (car entry)) | |
1324 (value (face-attribute face attribute))) | |
1325 (unless (eq value 'unspecified) | |
1326 (setq result (nconc (list attribute value) result))))))) | |
37943 | 1327 |
25012 | 1328 |
1329 (defun face-spec-set-match-display (display frame) | |
1330 "Non-nil if DISPLAY matches FRAME. | |
1331 DISPLAY is part of a spec such as can be used in `defface'. | |
1332 If FRAME is nil, the current FRAME is used." | |
1333 (let* ((conjuncts display) | |
1334 conjunct req options | |
1335 ;; t means we have succeeded against all the conjuncts in | |
1336 ;; DISPLAY that have been tested so far. | |
1337 (match t)) | |
1338 (if (eq conjuncts t) | |
1339 (setq conjuncts nil)) | |
1340 (while (and conjuncts match) | |
1341 (setq conjunct (car conjuncts) | |
1342 conjuncts (cdr conjuncts) | |
1343 req (car conjunct) | |
1344 options (cdr conjunct) | |
1345 match (cond ((eq req 'type) | |
1346 (or (memq window-system options) | |
33447
45961172564e
(face-spec-set-match-display): Revert the change from
Eli Zaretskii <eliz@gnu.org>
parents:
33419
diff
changeset
|
1347 ;; FIXME: This should be revisited to use |
45961172564e
(face-spec-set-match-display): Revert the change from
Eli Zaretskii <eliz@gnu.org>
parents:
33419
diff
changeset
|
1348 ;; display-graphic-p, provided that the |
45961172564e
(face-spec-set-match-display): Revert the change from
Eli Zaretskii <eliz@gnu.org>
parents:
33419
diff
changeset
|
1349 ;; color selection depends on the number |
45961172564e
(face-spec-set-match-display): Revert the change from
Eli Zaretskii <eliz@gnu.org>
parents:
33419
diff
changeset
|
1350 ;; of supported colors, and all defface's |
45961172564e
(face-spec-set-match-display): Revert the change from
Eli Zaretskii <eliz@gnu.org>
parents:
33419
diff
changeset
|
1351 ;; are changed to look at number of colors |
45961172564e
(face-spec-set-match-display): Revert the change from
Eli Zaretskii <eliz@gnu.org>
parents:
33419
diff
changeset
|
1352 ;; instead of (type graphic) etc. |
45961172564e
(face-spec-set-match-display): Revert the change from
Eli Zaretskii <eliz@gnu.org>
parents:
33419
diff
changeset
|
1353 (and (null window-system) |
45961172564e
(face-spec-set-match-display): Revert the change from
Eli Zaretskii <eliz@gnu.org>
parents:
33419
diff
changeset
|
1354 (memq 'tty options)) |
25887
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1355 (and (memq 'motif options) |
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1356 (featurep 'motif)) |
55545
70c4138d3b8d
* custom.el (defface): Document that type can have value gtk.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54574
diff
changeset
|
1357 (and (memq 'gtk options) |
70c4138d3b8d
* custom.el (defface): Document that type can have value gtk.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54574
diff
changeset
|
1358 (featurep 'gtk)) |
25887
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1359 (and (memq 'lucid options) |
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1360 (featurep 'x-toolkit) |
55545
70c4138d3b8d
* custom.el (defface): Document that type can have value gtk.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54574
diff
changeset
|
1361 (not (featurep 'motif)) |
70c4138d3b8d
* custom.el (defface): Document that type can have value gtk.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54574
diff
changeset
|
1362 (not (featurep 'gtk))) |
25887
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1363 (and (memq 'x-toolkit options) |
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1364 (featurep 'x-toolkit)))) |
54151
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1365 ((eq req 'min-colors) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1366 (>= (display-color-cells frame) (car options))) |
25012 | 1367 ((eq req 'class) |
1368 (memq (frame-parameter frame 'display-type) options)) | |
1369 ((eq req 'background) | |
1370 (memq (frame-parameter frame 'background-mode) | |
1371 options)) | |
45722
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
1372 ((eq req 'supports) |
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
1373 (display-supports-face-attributes-p options frame)) |
28840 | 1374 (t (error "Unknown req `%S' with options `%S'" |
25012 | 1375 req options))))) |
1376 match)) | |
1377 | |
1378 | |
1379 (defun face-spec-choose (spec &optional frame) | |
32758
a0ca98ed466a
(face-user-default-spec, face-default-spec): New functions.
Miles Bader <miles@gnu.org>
parents:
32756
diff
changeset
|
1380 "Choose the proper attributes for FRAME, out of SPEC. |
a0ca98ed466a
(face-user-default-spec, face-default-spec): New functions.
Miles Bader <miles@gnu.org>
parents:
32756
diff
changeset
|
1381 If SPEC is nil, return nil." |
25012 | 1382 (unless frame |
1383 (setq frame (selected-frame))) | |
1384 (let ((tail spec) | |
58935
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1385 result defaults) |
25012 | 1386 (while tail |
32940
80681aca0859
(face-spec-choose): Change syntax so that the list of attribute-value
Miles Bader <miles@gnu.org>
parents:
32801
diff
changeset
|
1387 (let* ((entry (pop tail)) |
80681aca0859
(face-spec-choose): Change syntax so that the list of attribute-value
Miles Bader <miles@gnu.org>
parents:
32801
diff
changeset
|
1388 (display (car entry)) |
58935
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1389 (attrs (cdr entry)) |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1390 thisval) |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1391 ;; Get the attributes as actually specified by this alternative. |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1392 (setq thisval |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1393 (if (null (cdr attrs)) ;; was (listp (car attrs)) |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1394 ;; Old-style entry, the attribute list is the |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1395 ;; first element. |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1396 (car attrs) |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1397 attrs)) |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1398 |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1399 ;; If the condition is `default', that sets the default |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1400 ;; for following conditions. |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1401 (if (eq display 'default) |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1402 (setq defaults thisval) |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1403 ;; Otherwise, if it matches, use it. |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1404 (when (face-spec-set-match-display display frame) |
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1405 (setq result thisval) |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1406 (setq tail nil))))) |
58935
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1407 (if defaults (append result defaults) result))) |
25012 | 1408 |
1409 | |
1410 (defun face-spec-reset-face (face &optional frame) | |
1411 "Reset all attributes of FACE on FRAME to unspecified." | |
31401
0b8165a82e34
(set-face-attribute, face-spec-reset-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31197
diff
changeset
|
1412 (let ((attrs face-attribute-name-alist)) |
25012 | 1413 (while attrs |
1414 (let ((attr-and-name (car attrs))) | |
31401
0b8165a82e34
(set-face-attribute, face-spec-reset-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31197
diff
changeset
|
1415 (set-face-attribute face frame (car attr-and-name) 'unspecified)) |
0b8165a82e34
(set-face-attribute, face-spec-reset-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31197
diff
changeset
|
1416 (setq attrs (cdr attrs))))) |
25012 | 1417 |
1418 | |
1419 (defun face-spec-set (face spec &optional frame) | |
1420 "Set FACE's attributes according to the first matching entry in SPEC. | |
1421 FRAME is the frame whose frame-local face is set. FRAME nil means | |
32758
a0ca98ed466a
(face-user-default-spec, face-default-spec): New functions.
Miles Bader <miles@gnu.org>
parents:
32756
diff
changeset
|
1422 do it on all frames. See `defface' for information about SPEC. |
a0ca98ed466a
(face-user-default-spec, face-default-spec): New functions.
Miles Bader <miles@gnu.org>
parents:
32756
diff
changeset
|
1423 If SPEC is nil, do nothing." |
31401
0b8165a82e34
(set-face-attribute, face-spec-reset-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31197
diff
changeset
|
1424 (let ((attrs (face-spec-choose spec frame))) |
31500
33b9a5b2a3bc
(face-spec-set): Only face-spec-reset-face when
Gerd Moellmann <gerd@gnu.org>
parents:
31466
diff
changeset
|
1425 (when attrs |
33b9a5b2a3bc
(face-spec-set): Only face-spec-reset-face when
Gerd Moellmann <gerd@gnu.org>
parents:
31466
diff
changeset
|
1426 (face-spec-reset-face face frame)) |
25012 | 1427 (while attrs |
1428 (let ((attribute (car attrs)) | |
1429 (value (car (cdr attrs)))) | |
1430 ;; Support some old-style attribute names and values. | |
1431 (case attribute | |
1432 (:bold (setq attribute :weight value (if value 'bold 'normal))) | |
30010
281fa98f5c87
(face-spec-set): Ignore invalid attributes like 20.x.
Gerd Moellmann <gerd@gnu.org>
parents:
29976
diff
changeset
|
1433 (:italic (setq attribute :slant value (if value 'italic 'normal))) |
34682
4130c0ad0a5e
(face-spec-set): Interpret a nil in specs for
Gerd Moellmann <gerd@gnu.org>
parents:
34587
diff
changeset
|
1434 ((:foreground :background) |
37943 | 1435 ;; Compatibility with 20.x. Some bogus face specs seem to |
34682
4130c0ad0a5e
(face-spec-set): Interpret a nil in specs for
Gerd Moellmann <gerd@gnu.org>
parents:
34587
diff
changeset
|
1436 ;; exist containing things like `:foreground nil'. |
4130c0ad0a5e
(face-spec-set): Interpret a nil in specs for
Gerd Moellmann <gerd@gnu.org>
parents:
34587
diff
changeset
|
1437 (if (null value) (setq value 'unspecified))) |
30010
281fa98f5c87
(face-spec-set): Ignore invalid attributes like 20.x.
Gerd Moellmann <gerd@gnu.org>
parents:
29976
diff
changeset
|
1438 (t (unless (assq attribute face-x-resources) |
281fa98f5c87
(face-spec-set): Ignore invalid attributes like 20.x.
Gerd Moellmann <gerd@gnu.org>
parents:
29976
diff
changeset
|
1439 (setq attribute nil)))) |
281fa98f5c87
(face-spec-set): Ignore invalid attributes like 20.x.
Gerd Moellmann <gerd@gnu.org>
parents:
29976
diff
changeset
|
1440 (when attribute |
31401
0b8165a82e34
(set-face-attribute, face-spec-reset-face)
Gerd Moellmann <gerd@gnu.org>
parents:
31197
diff
changeset
|
1441 (set-face-attribute face frame attribute value))) |
51280
c2efaecb5d8f
(set-face-attribute): Set face-modified prop to t
Richard M. Stallman <rms@gnu.org>
parents:
51248
diff
changeset
|
1442 (setq attrs (cdr (cdr attrs))))) |
c2efaecb5d8f
(set-face-attribute): Set face-modified prop to t
Richard M. Stallman <rms@gnu.org>
parents:
51248
diff
changeset
|
1443 ;; When we reset the face based on its spec, then it is unmodified |
c2efaecb5d8f
(set-face-attribute): Set face-modified prop to t
Richard M. Stallman <rms@gnu.org>
parents:
51248
diff
changeset
|
1444 ;; as far as Custom is concerned. |
c2efaecb5d8f
(set-face-attribute): Set face-modified prop to t
Richard M. Stallman <rms@gnu.org>
parents:
51248
diff
changeset
|
1445 (if (null frame) |
c2efaecb5d8f
(set-face-attribute): Set face-modified prop to t
Richard M. Stallman <rms@gnu.org>
parents:
51248
diff
changeset
|
1446 (put face 'face-modified nil))) |
25012 | 1447 |
1448 | |
1449 (defun face-attr-match-p (face attrs &optional frame) | |
30971 | 1450 "Return t if attributes of FACE match values in plist ATTRS. |
25012 | 1451 Optional parameter FRAME is the frame whose definition of FACE |
1452 is used. If nil or omitted, use the selected frame." | |
1453 (unless frame | |
1454 (setq frame (selected-frame))) | |
1455 (let ((list face-attribute-name-alist) | |
1456 (match t)) | |
1457 (while (and match (not (null list))) | |
1458 (let* ((attr (car (car list))) | |
30971 | 1459 (specified-value |
1460 (if (plist-member attrs attr) | |
1461 (plist-get attrs attr) | |
1462 'unspecified)) | |
25012 | 1463 (value-now (face-attribute face attr frame))) |
30971 | 1464 (setq match (equal specified-value value-now)) |
25012 | 1465 (setq list (cdr list)))) |
1466 match)) | |
1467 | |
1468 (defun face-spec-match-p (face spec &optional frame) | |
1469 "Return t if FACE, on FRAME, matches what SPEC says it should look like." | |
1470 (face-attr-match-p face (face-spec-choose spec frame) frame)) | |
1471 | |
32795
975cc2648ee4
(face-default-spec, face-user-default-spec): Make defsubsts.
Miles Bader <miles@gnu.org>
parents:
32758
diff
changeset
|
1472 (defsubst face-default-spec (face) |
975cc2648ee4
(face-default-spec, face-user-default-spec): Make defsubsts.
Miles Bader <miles@gnu.org>
parents:
32758
diff
changeset
|
1473 "Return the default face-spec for FACE, ignoring any user customization. |
975cc2648ee4
(face-default-spec, face-user-default-spec): Make defsubsts.
Miles Bader <miles@gnu.org>
parents:
32758
diff
changeset
|
1474 If there is no default for FACE, return nil." |
975cc2648ee4
(face-default-spec, face-user-default-spec): Make defsubsts.
Miles Bader <miles@gnu.org>
parents:
32758
diff
changeset
|
1475 (get face 'face-defface-spec)) |
975cc2648ee4
(face-default-spec, face-user-default-spec): Make defsubsts.
Miles Bader <miles@gnu.org>
parents:
32758
diff
changeset
|
1476 |
975cc2648ee4
(face-default-spec, face-user-default-spec): Make defsubsts.
Miles Bader <miles@gnu.org>
parents:
32758
diff
changeset
|
1477 (defsubst face-user-default-spec (face) |
32758
a0ca98ed466a
(face-user-default-spec, face-default-spec): New functions.
Miles Bader <miles@gnu.org>
parents:
32756
diff
changeset
|
1478 "Return the user's customized face-spec for FACE, or the default if none. |
37467
342409bb6b91
(modify-face): Add compatibility for non-interactive use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37294
diff
changeset
|
1479 If there is neither a user setting nor a default for FACE, return nil." |
32758
a0ca98ed466a
(face-user-default-spec, face-default-spec): New functions.
Miles Bader <miles@gnu.org>
parents:
32756
diff
changeset
|
1480 (or (get face 'saved-face) |
32795
975cc2648ee4
(face-default-spec, face-user-default-spec): Make defsubsts.
Miles Bader <miles@gnu.org>
parents:
32758
diff
changeset
|
1481 (face-default-spec face))) |
25012 | 1482 |
1483 | |
1484 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1485 ;;; Frame-type independent color support. |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1486 ;;; We keep the old x-* names as aliases for back-compatibility. |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1487 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1488 |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1489 (defun defined-colors (&optional frame) |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1490 "Return a list of colors supported for a particular frame. |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1491 The argument FRAME specifies which frame to try. |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1492 The value may be different for frames on different display types. |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1493 If FRAME doesn't support colors, the value is nil." |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32734
diff
changeset
|
1494 (if (memq (framep (or frame (selected-frame))) '(x w32 mac)) |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1495 (xw-defined-colors frame) |
27090
52e469fb402a
(read-face-attribute, defined-colors, color-defined-p):
Eli Zaretskii <eliz@gnu.org>
parents:
26927
diff
changeset
|
1496 (mapcar 'car (tty-color-alist frame)))) |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1497 (defalias 'x-defined-colors 'defined-colors) |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1498 |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1499 (defun color-defined-p (color &optional frame) |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1500 "Return non-nil if color COLOR is supported on frame FRAME. |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1501 If FRAME is omitted or nil, use the selected frame. |
27117
6838a53d4992
(face-read-integer, read-face-attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
27090
diff
changeset
|
1502 If COLOR is the symbol `unspecified' or one of the strings |
6838a53d4992
(face-read-integer, read-face-attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
27090
diff
changeset
|
1503 \"unspecified-fg\" or \"unspecified-bg\", the value is nil." |
32734
92b46ad86f6a
(color-values, color-defined-p): Use `member', not
Miles Bader <miles@gnu.org>
parents:
32649
diff
changeset
|
1504 (if (member color '(unspecified "unspecified-bg" "unspecified-fg")) |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1505 nil |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32734
diff
changeset
|
1506 (if (member (framep (or frame (selected-frame))) '(x w32 mac)) |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1507 (xw-color-defined-p color frame) |
27090
52e469fb402a
(read-face-attribute, defined-colors, color-defined-p):
Eli Zaretskii <eliz@gnu.org>
parents:
26927
diff
changeset
|
1508 (numberp (tty-color-translate color frame))))) |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1509 (defalias 'x-color-defined-p 'color-defined-p) |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1510 |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1511 (defun color-values (color &optional frame) |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1512 "Return a description of the color named COLOR on frame FRAME. |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1513 The value is a list of integer RGB values--\(RED GREEN BLUE\). |
31466 | 1514 These values appear to range from 0 65535; white is \(65535 65535 65535\). |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1515 If FRAME is omitted or nil, use the selected frame. |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1516 If FRAME cannot display COLOR, the value is nil. |
27117
6838a53d4992
(face-read-integer, read-face-attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
27090
diff
changeset
|
1517 If COLOR is the symbol `unspecified' or one of the strings |
6838a53d4992
(face-read-integer, read-face-attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
27090
diff
changeset
|
1518 \"unspecified-fg\" or \"unspecified-bg\", the value is nil." |
32734
92b46ad86f6a
(color-values, color-defined-p): Use `member', not
Miles Bader <miles@gnu.org>
parents:
32649
diff
changeset
|
1519 (if (member color '(unspecified "unspecified-fg" "unspecified-bg")) |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1520 nil |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32734
diff
changeset
|
1521 (if (memq (framep (or frame (selected-frame))) '(x w32 mac)) |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1522 (xw-color-values color frame) |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1523 (tty-color-values color frame)))) |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1524 (defalias 'x-color-values 'color-values) |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1525 |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1526 (defun display-color-p (&optional display) |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1527 "Return t if DISPLAY supports color. |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1528 The optional argument DISPLAY specifies which display to ask about. |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1529 DISPLAY should be either a frame or a display name (a string). |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1530 If omitted or nil, that stands for the selected frame's display." |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32734
diff
changeset
|
1531 (if (memq (framep-on-display display) '(x w32 mac)) |
27571
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1532 (xw-display-color-p display) |
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1533 (tty-display-color-p display))) |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1534 (defalias 'x-display-color-p 'display-color-p) |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1535 |
27571
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1536 (defun display-grayscale-p (&optional display) |
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1537 "Return non-nil if frames on DISPLAY can display shades of gray." |
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1538 (let ((frame-type (framep-on-display display))) |
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1539 (cond |
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1540 ((memq frame-type '(x w32 mac)) |
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1541 (x-display-grayscale-p display)) |
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1542 (t |
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1543 (> (tty-color-gray-shades display) 2))))) |
4a4f7f602836
(display-color-p): Use framep-on-display.
Eli Zaretskii <eliz@gnu.org>
parents:
27117
diff
changeset
|
1544 |
26736
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1545 |
a0674327c167
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26657
diff
changeset
|
1546 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
25012 | 1547 ;;; Background mode. |
1548 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1549 | |
1550 (defcustom frame-background-mode nil | |
1551 "*The brightness of the background. | |
1552 Set this to the symbol `dark' if your background color is dark, `light' if | |
1553 your background is light, or nil (default) if you want Emacs to | |
30188
d6809f9c7d37
(frame-background-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30010
diff
changeset
|
1554 examine the brightness for you. Don't set this variable with `setq'; |
d6809f9c7d37
(frame-background-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
30010
diff
changeset
|
1555 this won't have the expected effect." |
25012 | 1556 :group 'faces |
1557 :set #'(lambda (var value) | |
29769
18a16ab69699
(frame-background-mode): Use set-default, not set, in setter.
Dave Love <fx@gnu.org>
parents:
29354
diff
changeset
|
1558 (set-default var value) |
31528
a461cad7a942
(face-x-resources): Make custom type more specific.
Dave Love <fx@gnu.org>
parents:
31500
diff
changeset
|
1559 (mapc 'frame-set-background-mode (frame-list))) |
25012 | 1560 :initialize 'custom-initialize-changed |
28840 | 1561 :type '(choice (choice-item dark) |
25012 | 1562 (choice-item light) |
1563 (choice-item :tag "default" nil))) | |
1564 | |
1565 | |
1566 (defun frame-set-background-mode (frame) | |
32649
47bf921bccd5
(frame-set-background-mode): `unspecified' &c are symbols, not strings.
Miles Bader <miles@gnu.org>
parents:
32641
diff
changeset
|
1567 "Set up display-dependent faces on FRAME. |
47bf921bccd5
(frame-set-background-mode): `unspecified' &c are symbols, not strings.
Miles Bader <miles@gnu.org>
parents:
32641
diff
changeset
|
1568 Display-dependent faces are those which have different definitions |
47bf921bccd5
(frame-set-background-mode): `unspecified' &c are symbols, not strings.
Miles Bader <miles@gnu.org>
parents:
32641
diff
changeset
|
1569 according to the `background-mode' and `display-type' frame parameters." |
25012 | 1570 (let* ((bg-resource |
1571 (and window-system | |
50025
ffbc79f0f914
(frame-set-background-mode): Fix reference to attribute "backgroundMode".
Juanma Barranquero <lekktu@gmail.com>
parents:
48914
diff
changeset
|
1572 (x-get-resource "backgroundMode" "BackgroundMode"))) |
32641
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1573 (bg-color (frame-parameter frame 'background-color)) |
32376 | 1574 (bg-mode |
1575 (cond (frame-background-mode) | |
32641
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1576 (bg-resource |
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1577 (intern (downcase bg-resource))) |
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1578 ((and (null window-system) (null bg-color)) |
32376 | 1579 ;; No way to determine this automatically (?). |
1580 'dark) | |
32641
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1581 ;; Unspecified frame background color can only happen |
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1582 ;; on tty's. |
32734
92b46ad86f6a
(color-values, color-defined-p): Use `member', not
Miles Bader <miles@gnu.org>
parents:
32649
diff
changeset
|
1583 ((member bg-color '(unspecified "unspecified-bg")) |
32641
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1584 'dark) |
32734
92b46ad86f6a
(color-values, color-defined-p): Use `member', not
Miles Bader <miles@gnu.org>
parents:
32649
diff
changeset
|
1585 ((equal bg-color "unspecified-fg") ; inverted colors |
32641
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1586 'light) |
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1587 ((>= (apply '+ (x-color-values bg-color frame)) |
32376 | 1588 ;; Just looking at the screen, colors whose |
1589 ;; values add up to .6 of the white total | |
1590 ;; still look dark to me. | |
1591 (* (apply '+ (x-color-values "white" frame)) .6)) | |
32641
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1592 'light) |
48709f040160
(frame-set-background-mode): If a tty frame defines a
Eli Zaretskii <eliz@gnu.org>
parents:
32404
diff
changeset
|
1593 (t 'dark))) |
32376 | 1594 (display-type |
1595 (cond ((null window-system) | |
1596 (if (tty-display-color-p frame) 'color 'mono)) | |
1597 ((x-display-color-p frame) | |
1598 'color) | |
1599 ((x-display-grayscale-p frame) | |
1600 'grayscale) | |
1601 (t 'mono))) | |
1602 (old-bg-mode | |
1603 (frame-parameter frame 'background-mode)) | |
1604 (old-display-type | |
1605 (frame-parameter frame 'display-type))) | |
1606 | |
1607 (unless (and (eq bg-mode old-bg-mode) (eq display-type old-display-type)) | |
34246
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1608 (let ((locally-modified-faces nil)) |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1609 ;; Before modifying the frame parameters, we collect a list of |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1610 ;; faces that don't match what their face-spec says they should |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1611 ;; look like; we then avoid changing these faces below. A |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1612 ;; negative list is used on the assumption that most faces will |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1613 ;; be unmodified, so we can avoid consing in the common case. |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1614 (dolist (face (face-list)) |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1615 (when (not (face-spec-match-p face |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1616 (face-user-default-spec face) |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1617 (selected-frame))) |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1618 (push face locally-modified-faces))) |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1619 ;; Now change to the new frame parameters |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1620 (modify-frame-parameters frame |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1621 (list (cons 'background-mode bg-mode) |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1622 (cons 'display-type display-type))) |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1623 ;; For all named faces, choose face specs matching the new frame |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1624 ;; parameters, unless they have been locally modified. |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1625 (dolist (face (face-list)) |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1626 (unless (memq face locally-modified-faces) |
e7acfcef56ae
(frame-set-background-mode): Avoid stomping on locally modified faces.
Miles Bader <miles@gnu.org>
parents:
34162
diff
changeset
|
1627 (face-spec-set face (face-user-default-spec face) frame))))))) |
25012 | 1628 |
1629 | |
1630 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1631 ;;; Frame creation. | |
1632 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1633 | |
1634 (defun x-handle-named-frame-geometry (parameters) | |
1635 "Add geometry parameters for a named frame to parameter list PARAMETERS. | |
1636 Value is the new parameter list." | |
1637 (let* ((name (or (cdr (assq 'name parameters)) | |
1638 (cdr (assq 'name default-frame-alist)))) | |
1639 (x-resource-name name) | |
1640 (res-geometry (if name (x-get-resource "geometry" "Geometry")))) | |
1641 (when res-geometry | |
1642 (let ((parsed (x-parse-geometry res-geometry))) | |
1643 ;; If the resource specifies a position, call the position | |
1644 ;; and size "user-specified". | |
1645 (when (or (assq 'top parsed) | |
1646 (assq 'left parsed)) | |
1647 (setq parsed (append '((user-position . t) (user-size . t)) parsed))) | |
1648 ;; Put the geometry parameters at the end. Copy | |
1649 ;; default-frame-alist so that they go after it. | |
1650 (setq parameters (append parameters default-frame-alist parsed)))) | |
1651 parameters)) | |
1652 | |
1653 | |
1654 (defun x-handle-reverse-video (frame parameters) | |
1655 "Handle the reverse-video frame parameter and X resource. | |
1656 `x-create-frame' does not handle this one." | |
1657 (when (cdr (or (assq 'reverse parameters) | |
1658 (assq 'reverse default-frame-alist) | |
1659 (let ((resource (x-get-resource "reverseVideo" | |
1660 "ReverseVideo"))) | |
1661 (if resource | |
1662 (cons nil (member (downcase resource) | |
1663 '("on" "true"))))))) | |
1664 (let* ((params (frame-parameters frame)) | |
1665 (bg (cdr (assq 'foreground-color params))) | |
1666 (fg (cdr (assq 'background-color params)))) | |
1667 (modify-frame-parameters frame | |
1668 (list (cons 'foreground-color fg) | |
1669 (cons 'background-color bg))) | |
1670 (if (equal bg (cdr (assq 'border-color params))) | |
1671 (modify-frame-parameters frame | |
1672 (list (cons 'border-color fg)))) | |
1673 (if (equal bg (cdr (assq 'mouse-color params))) | |
1674 (modify-frame-parameters frame | |
1675 (list (cons 'mouse-color fg)))) | |
1676 (if (equal bg (cdr (assq 'cursor-color params))) | |
1677 (modify-frame-parameters frame | |
1678 (list (cons 'cursor-color fg))))))) | |
1679 | |
1680 | |
1681 (defun x-create-frame-with-faces (&optional parameters) | |
1682 "Create a frame from optional frame parameters PARAMETERS. | |
1683 Parameters not specified by PARAMETERS are taken from | |
1684 `default-frame-alist'. If PARAMETERS specify a frame name, | |
1685 handle X geometry resources for that name. If either PARAMETERS | |
1686 or `default-frame-alist' contains a `reverse' parameter, or | |
1687 the X resource ``reverseVideo'' is present, handle that. | |
1688 Value is the new frame created." | |
1689 (setq parameters (x-handle-named-frame-geometry parameters)) | |
1690 (let ((visibility-spec (assq 'visibility parameters)) | |
1691 (frame-list (frame-list)) | |
1692 (frame (x-create-frame (cons '(visibility . nil) parameters))) | |
1693 success) | |
1694 (unwind-protect | |
1695 (progn | |
1696 (x-handle-reverse-video frame parameters) | |
1697 (frame-set-background-mode frame) | |
51248
e21b4eb91135
(x-create-frame-with-faces): Call `face-set-after-frame-default'.
John Paul Wallington <jpw@pobox.com>
parents:
51095
diff
changeset
|
1698 (face-set-after-frame-default frame) |
25012 | 1699 (if (or (null frame-list) (null visibility-spec)) |
1700 (make-frame-visible frame) | |
1701 (modify-frame-parameters frame (list visibility-spec))) | |
1702 (setq success t)) | |
1703 (unless success | |
1704 (delete-frame frame))) | |
1705 frame)) | |
1706 | |
1707 | |
1708 (defun face-set-after-frame-default (frame) | |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1709 "Set frame-local faces of FRAME from face specs and resources. |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1710 Initialize colors of certain faces from frame parameters." |
51095
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1711 (if (face-attribute 'default :font t) |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1712 (set-face-attribute 'default frame :font |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1713 (face-attribute 'default :font t)) |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1714 (set-face-attribute 'default frame :family |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1715 (face-attribute 'default :family t)) |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1716 (set-face-attribute 'default frame :height |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1717 (face-attribute 'default :height t)) |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1718 (set-face-attribute 'default frame :slant |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1719 (face-attribute 'default :slant t)) |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1720 (set-face-attribute 'default frame :weight |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1721 (face-attribute 'default :weight t)) |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1722 (set-face-attribute 'default frame :width |
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1723 (face-attribute 'default :width t))) |
25012 | 1724 (dolist (face (face-list)) |
51095
8b14c07986ec
(x-create-frame-with-faces): Don't call face-set-after-frame-default.
Richard M. Stallman <rms@gnu.org>
parents:
50025
diff
changeset
|
1725 ;; Don't let frame creation fail because of an invalid face spec. |
48522
70e8f2b6672e
(face-set-after-frame-default): Ignore errors in face-spec-face-set.
Richard M. Stallman <rms@gnu.org>
parents:
47258
diff
changeset
|
1726 (condition-case () |
70e8f2b6672e
(face-set-after-frame-default): Ignore errors in face-spec-face-set.
Richard M. Stallman <rms@gnu.org>
parents:
47258
diff
changeset
|
1727 (when (not (equal face 'default)) |
70e8f2b6672e
(face-set-after-frame-default): Ignore errors in face-spec-face-set.
Richard M. Stallman <rms@gnu.org>
parents:
47258
diff
changeset
|
1728 (face-spec-set face (face-user-default-spec face) frame) |
70e8f2b6672e
(face-set-after-frame-default): Ignore errors in face-spec-face-set.
Richard M. Stallman <rms@gnu.org>
parents:
47258
diff
changeset
|
1729 (internal-merge-in-global-face face frame) |
70e8f2b6672e
(face-set-after-frame-default): Ignore errors in face-spec-face-set.
Richard M. Stallman <rms@gnu.org>
parents:
47258
diff
changeset
|
1730 (when (and (memq window-system '(x w32 mac)) |
70e8f2b6672e
(face-set-after-frame-default): Ignore errors in face-spec-face-set.
Richard M. Stallman <rms@gnu.org>
parents:
47258
diff
changeset
|
1731 (or (not (boundp 'inhibit-default-face-x-resources)) |
70e8f2b6672e
(face-set-after-frame-default): Ignore errors in face-spec-face-set.
Richard M. Stallman <rms@gnu.org>
parents:
47258
diff
changeset
|
1732 (not (eq face 'default)))) |
70e8f2b6672e
(face-set-after-frame-default): Ignore errors in face-spec-face-set.
Richard M. Stallman <rms@gnu.org>
parents:
47258
diff
changeset
|
1733 (make-face-x-resource-internal face frame))) |
70e8f2b6672e
(face-set-after-frame-default): Ignore errors in face-spec-face-set.
Richard M. Stallman <rms@gnu.org>
parents:
47258
diff
changeset
|
1734 (error nil))) |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1735 ;; Initialize attributes from frame parameters. |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1736 (let ((params '((foreground-color default :foreground) |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1737 (background-color default :background) |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1738 (border-color border :background) |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1739 (cursor-color cursor :background) |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1740 (scroll-bar-foreground scroll-bar :foreground) |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1741 (scroll-bar-background scroll-bar :background) |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1742 (mouse-color mouse :background)))) |
33852
01da583dbe56
(face-set-after-frame-default): Let face attributes
Gerd Moellmann <gerd@gnu.org>
parents:
33756
diff
changeset
|
1743 (dolist (param params) |
01da583dbe56
(face-set-after-frame-default): Let face attributes
Gerd Moellmann <gerd@gnu.org>
parents:
33756
diff
changeset
|
1744 (let ((frame-param (frame-parameter frame (nth 0 param))) |
01da583dbe56
(face-set-after-frame-default): Let face attributes
Gerd Moellmann <gerd@gnu.org>
parents:
33756
diff
changeset
|
1745 (face (nth 1 param)) |
01da583dbe56
(face-set-after-frame-default): Let face attributes
Gerd Moellmann <gerd@gnu.org>
parents:
33756
diff
changeset
|
1746 (attr (nth 2 param))) |
01da583dbe56
(face-set-after-frame-default): Let face attributes
Gerd Moellmann <gerd@gnu.org>
parents:
33756
diff
changeset
|
1747 (when (and frame-param |
01da583dbe56
(face-set-after-frame-default): Let face attributes
Gerd Moellmann <gerd@gnu.org>
parents:
33756
diff
changeset
|
1748 ;; Don't override face attributes explicitly |
01da583dbe56
(face-set-after-frame-default): Let face attributes
Gerd Moellmann <gerd@gnu.org>
parents:
33756
diff
changeset
|
1749 ;; specified for new frames. |
01da583dbe56
(face-set-after-frame-default): Let face attributes
Gerd Moellmann <gerd@gnu.org>
parents:
33756
diff
changeset
|
1750 (eq (face-attribute face attr t) 'unspecified)) |
01da583dbe56
(face-set-after-frame-default): Let face attributes
Gerd Moellmann <gerd@gnu.org>
parents:
33756
diff
changeset
|
1751 (set-face-attribute face frame attr frame-param)))))) |
01da583dbe56
(face-set-after-frame-default): Let face attributes
Gerd Moellmann <gerd@gnu.org>
parents:
33756
diff
changeset
|
1752 |
25012 | 1753 |
33008
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1754 (defun tty-handle-reverse-video (frame parameters) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1755 "Handle the reverse-video frame parameter for terminal frames." |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1756 (when (cdr (or (assq 'reverse parameters) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1757 (assq 'reverse default-frame-alist))) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1758 (let* ((params (frame-parameters frame)) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1759 (bg (cdr (assq 'foreground-color params))) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1760 (fg (cdr (assq 'background-color params)))) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1761 (modify-frame-parameters frame |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1762 (list (cons 'foreground-color fg) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1763 (cons 'background-color bg))) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1764 (if (equal bg (cdr (assq 'mouse-color params))) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1765 (modify-frame-parameters frame |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1766 (list (cons 'mouse-color fg)))) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1767 (if (equal bg (cdr (assq 'cursor-color params))) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1768 (modify-frame-parameters frame |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1769 (list (cons 'cursor-color fg))))))) |
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1770 |
25012 | 1771 |
1772 (defun tty-create-frame-with-faces (&optional parameters) | |
1773 "Create a frame from optional frame parameters PARAMETERS. | |
1774 Parameters not specified by PARAMETERS are taken from | |
1775 `default-frame-alist'. If either PARAMETERS or `default-frame-alist' | |
1776 contains a `reverse' parameter, handle that. Value is the new frame | |
1777 created." | |
1778 (let ((frame (make-terminal-frame parameters)) | |
1779 success) | |
1780 (unwind-protect | |
1781 (progn | |
33008
c30c394884b8
(tty-handle-reverse-video): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
32940
diff
changeset
|
1782 (tty-handle-reverse-video frame (frame-parameters frame)) |
25012 | 1783 (frame-set-background-mode frame) |
1784 (face-set-after-frame-default frame) | |
1785 (setq success t)) | |
1786 (unless success | |
1787 (delete-frame frame))) | |
1788 frame)) | |
1789 | |
1790 | |
1791 ;; Called from C function init_display to initialize faces of the | |
1792 ;; dumped terminal frame on startup. | |
1793 | |
1794 (defun tty-set-up-initial-frame-faces () | |
1795 (let ((frame (selected-frame))) | |
1796 (frame-set-background-mode frame) | |
1797 (face-set-after-frame-default frame))) | |
37943 | 1798 |
25012 | 1799 |
1800 | |
1801 | |
1802 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1803 ;;; Compatiblity with 20.2 | |
1804 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1805 | |
1806 ;; Update a frame's faces when we change its default font. | |
1807 | |
55883
cde9d1fff89c
(frame-update-faces): Add empty docstring so the one for `ignore' doesn't
Juanma Barranquero <lekktu@gmail.com>
parents:
55545
diff
changeset
|
1808 (defalias 'frame-update-faces 'ignore "") |
46053
ef0684c3e07b
(frame-update-faces): Fix obsolescence declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
46041
diff
changeset
|
1809 (make-obsolete 'frame-update-faces "no longer necessary." "21.1") |
25012 | 1810 |
1811 ;; Update the colors of FACE, after FRAME's own colors have been | |
1812 ;; changed. | |
1813 | |
29769
18a16ab69699
(frame-background-mode): Use set-default, not set, in setter.
Dave Love <fx@gnu.org>
parents:
29354
diff
changeset
|
1814 (defalias 'frame-update-face-colors 'frame-set-background-mode) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
1815 (make-obsolete 'frame-update-face-colors 'frame-set-background-mode "21.1") |
25012 | 1816 |
1817 | |
1818 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1819 ;;; Standard faces. | |
1820 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1821 | |
1822 (defgroup basic-faces nil | |
1823 "The standard faces of Emacs." | |
1824 :group 'faces) | |
1825 | |
1826 | |
1827 (defface default | |
1828 '((t nil)) | |
1829 "Basic default face." | |
1830 :group 'basic-faces) | |
1831 | |
1832 | |
25650
8b06b47a1fea
(mode-line): Replaces `modeline'.
Gerd Moellmann <gerd@gnu.org>
parents:
25616
diff
changeset
|
1833 (defface mode-line |
59077
294a7f7e3daf
(mode-line, mode-line-inactive): Use min-colors.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59054
diff
changeset
|
1834 '((((class color) (min-colors 88)) |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1835 :box (:line-width -1 :style released-button) |
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1836 :background "grey75" :foreground "black") |
25012 | 1837 (t |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1838 :inverse-video t)) |
43204
1b0f33edf842
(mode-line-inactive): New face for mode-line for
Kim F. Storm <storm@cua.dk>
parents:
42969
diff
changeset
|
1839 "Basic mode line face for selected window." |
25687
afad62240679
(mode-line, header-line, tool-bar, ): Add :version.
Dave Love <fx@gnu.org>
parents:
25650
diff
changeset
|
1840 :version "21.1" |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1841 :group 'modeline |
25012 | 1842 :group 'basic-faces) |
1843 | |
43204
1b0f33edf842
(mode-line-inactive): New face for mode-line for
Kim F. Storm <storm@cua.dk>
parents:
42969
diff
changeset
|
1844 (defface mode-line-inactive |
58935
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1845 '((default |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1846 :inherit mode-line) |
59077
294a7f7e3daf
(mode-line, mode-line-inactive): Use min-colors.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59054
diff
changeset
|
1847 (((class color) (min-colors 88) (background light)) |
43204
1b0f33edf842
(mode-line-inactive): New face for mode-line for
Kim F. Storm <storm@cua.dk>
parents:
42969
diff
changeset
|
1848 :weight light |
1b0f33edf842
(mode-line-inactive): New face for mode-line for
Kim F. Storm <storm@cua.dk>
parents:
42969
diff
changeset
|
1849 :box (:line-width -1 :color "grey75" :style nil) |
1b0f33edf842
(mode-line-inactive): New face for mode-line for
Kim F. Storm <storm@cua.dk>
parents:
42969
diff
changeset
|
1850 :foreground "grey20" :background "grey90") |
59077
294a7f7e3daf
(mode-line, mode-line-inactive): Use min-colors.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
59054
diff
changeset
|
1851 (((class color) (min-colors 88) (background dark) ) |
43247
4c5a2e2ddf43
(mode-line-inactive): Add dark-background variant.
Miles Bader <miles@gnu.org>
parents:
43204
diff
changeset
|
1852 :weight light |
4c5a2e2ddf43
(mode-line-inactive): Add dark-background variant.
Miles Bader <miles@gnu.org>
parents:
43204
diff
changeset
|
1853 :box (:line-width -1 :color "grey40" :style nil) |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1854 :foreground "grey80" :background "grey30")) |
43204
1b0f33edf842
(mode-line-inactive): New face for mode-line for
Kim F. Storm <storm@cua.dk>
parents:
42969
diff
changeset
|
1855 "Basic mode line face for non-selected windows." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59872
diff
changeset
|
1856 :version "22.1" |
43204
1b0f33edf842
(mode-line-inactive): New face for mode-line for
Kim F. Storm <storm@cua.dk>
parents:
42969
diff
changeset
|
1857 :group 'modeline |
1b0f33edf842
(mode-line-inactive): New face for mode-line for
Kim F. Storm <storm@cua.dk>
parents:
42969
diff
changeset
|
1858 :group 'basic-faces) |
1b0f33edf842
(mode-line-inactive): New face for mode-line for
Kim F. Storm <storm@cua.dk>
parents:
42969
diff
changeset
|
1859 |
62656
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1860 (defface mode-line-highlight |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1861 '((((class color) (min-colors 88) (background light)) |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1862 :background "RoyalBlue4" :foreground "white") |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1863 (((class color) (min-colors 88) (background dark)) |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1864 :background "light sky blue" :foreground "black") |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1865 (t |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1866 :inverse-video t)) |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1867 "Basic mode line face for highlighting." |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1868 :version "22.1" |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1869 :group 'modeline |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1870 :group 'basic-faces) |
de74a397ff54
Install a change I forgot to install at the last committing.
Masatake YAMATO <jet@gyve.org>
parents:
62534
diff
changeset
|
1871 |
25650
8b06b47a1fea
(mode-line): Replaces `modeline'.
Gerd Moellmann <gerd@gnu.org>
parents:
25616
diff
changeset
|
1872 ;; Make `modeline' an alias for `mode-line', for compatibility. |
8b06b47a1fea
(mode-line): Replaces `modeline'.
Gerd Moellmann <gerd@gnu.org>
parents:
25616
diff
changeset
|
1873 (put 'modeline 'face-alias 'mode-line) |
43204
1b0f33edf842
(mode-line-inactive): New face for mode-line for
Kim F. Storm <storm@cua.dk>
parents:
42969
diff
changeset
|
1874 (put 'modeline-inactive 'face-alias 'mode-line-inactive) |
63311
212616057d0b
(modeline-highlight): Rename from (the erroneous) `modeline-higilight'.
Eli Zaretskii <eliz@gnu.org>
parents:
63140
diff
changeset
|
1875 (put 'modeline-highlight 'face-alias 'mode-line-highlight) |
25012 | 1876 |
25545
b0a117037bde
(header-line): Renamed from `top-line'.
Gerd Moellmann <gerd@gnu.org>
parents:
25542
diff
changeset
|
1877 (defface header-line |
58935
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1878 '((default |
54574
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1879 :inherit mode-line) |
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1880 (((type tty)) |
32404
d355f52b4497
(header-line): Change tty-variant to use underlining.
Miles Bader <miles@gnu.org>
parents:
32378
diff
changeset
|
1881 ;; This used to be `:inverse-video t', but that doesn't look very |
d355f52b4497
(header-line): Change tty-variant to use underlining.
Miles Bader <miles@gnu.org>
parents:
32378
diff
changeset
|
1882 ;; good when combined with inverse-video mode-lines and multiple |
d355f52b4497
(header-line): Change tty-variant to use underlining.
Miles Bader <miles@gnu.org>
parents:
32378
diff
changeset
|
1883 ;; windows. Underlining looks better, and is more consistent with |
d355f52b4497
(header-line): Change tty-variant to use underlining.
Miles Bader <miles@gnu.org>
parents:
32378
diff
changeset
|
1884 ;; the window-system face variants, which deemphasize the |
d355f52b4497
(header-line): Change tty-variant to use underlining.
Miles Bader <miles@gnu.org>
parents:
32378
diff
changeset
|
1885 ;; header-line in relation to the mode-line face. If a terminal |
d355f52b4497
(header-line): Change tty-variant to use underlining.
Miles Bader <miles@gnu.org>
parents:
32378
diff
changeset
|
1886 ;; can't underline, then the header-line will end up without any |
d355f52b4497
(header-line): Change tty-variant to use underlining.
Miles Bader <miles@gnu.org>
parents:
32378
diff
changeset
|
1887 ;; highlighting; this may be too confusing in general, although it |
d355f52b4497
(header-line): Change tty-variant to use underlining.
Miles Bader <miles@gnu.org>
parents:
32378
diff
changeset
|
1888 ;; happens to look good with the only current use of header-lines, |
d355f52b4497
(header-line): Change tty-variant to use underlining.
Miles Bader <miles@gnu.org>
parents:
32378
diff
changeset
|
1889 ;; the info browser. XXX |
54574
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1890 :inverse-video nil ;Override the value inherited from mode-line. |
46146
f883ac732e39
(header-line): Don't use a `common' clause for inheriting from the mode-line
Miles Bader <miles@gnu.org>
parents:
46145
diff
changeset
|
1891 :underline t) |
32756
ccfb1ed059ca
(header-line): Make more reasonable on mono/grayscale displays.
Miles Bader <miles@gnu.org>
parents:
32752
diff
changeset
|
1892 (((class color grayscale) (background light)) |
33465
900ca3da6e01
(header-line): Use `:box nil' for color/gs displays too.
Miles Bader <miles@gnu.org>
parents:
33447
diff
changeset
|
1893 :background "grey90" :foreground "grey20" |
54574
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1894 :box nil) |
32756
ccfb1ed059ca
(header-line): Make more reasonable on mono/grayscale displays.
Miles Bader <miles@gnu.org>
parents:
32752
diff
changeset
|
1895 (((class color grayscale) (background dark)) |
33465
900ca3da6e01
(header-line): Use `:box nil' for color/gs displays too.
Miles Bader <miles@gnu.org>
parents:
33447
diff
changeset
|
1896 :background "grey20" :foreground "grey90" |
54574
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1897 :box nil) |
32756
ccfb1ed059ca
(header-line): Make more reasonable on mono/grayscale displays.
Miles Bader <miles@gnu.org>
parents:
32752
diff
changeset
|
1898 (((class mono) (background light)) |
33465
900ca3da6e01
(header-line): Use `:box nil' for color/gs displays too.
Miles Bader <miles@gnu.org>
parents:
33447
diff
changeset
|
1899 :background "white" :foreground "black" |
900ca3da6e01
(header-line): Use `:box nil' for color/gs displays too.
Miles Bader <miles@gnu.org>
parents:
33447
diff
changeset
|
1900 :inverse-video nil |
900ca3da6e01
(header-line): Use `:box nil' for color/gs displays too.
Miles Bader <miles@gnu.org>
parents:
33447
diff
changeset
|
1901 :box nil |
54574
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1902 :underline t) |
32756
ccfb1ed059ca
(header-line): Make more reasonable on mono/grayscale displays.
Miles Bader <miles@gnu.org>
parents:
32752
diff
changeset
|
1903 (((class mono) (background dark)) |
33465
900ca3da6e01
(header-line): Use `:box nil' for color/gs displays too.
Miles Bader <miles@gnu.org>
parents:
33447
diff
changeset
|
1904 :background "black" :foreground "white" |
900ca3da6e01
(header-line): Use `:box nil' for color/gs displays too.
Miles Bader <miles@gnu.org>
parents:
33447
diff
changeset
|
1905 :inverse-video nil |
900ca3da6e01
(header-line): Use `:box nil' for color/gs displays too.
Miles Bader <miles@gnu.org>
parents:
33447
diff
changeset
|
1906 :box nil |
54574
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1907 :underline t)) |
25545
b0a117037bde
(header-line): Renamed from `top-line'.
Gerd Moellmann <gerd@gnu.org>
parents:
25542
diff
changeset
|
1908 "Basic header-line face." |
25687
afad62240679
(mode-line, header-line, tool-bar, ): Add :version.
Dave Love <fx@gnu.org>
parents:
25650
diff
changeset
|
1909 :version "21.1" |
25012 | 1910 :group 'basic-faces) |
1911 | |
1912 | |
25542
047532b73119
(tool-bar): Change face `toolbar' to `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25494
diff
changeset
|
1913 (defface tool-bar |
58935
95bb6b9a27a3
(header-line, mode-line-inactive, tool-bar):
Richard M. Stallman <rms@gnu.org>
parents:
58851
diff
changeset
|
1914 '((default |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1915 :box (:line-width 1 :style released-button) |
54574
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1916 :foreground "black") |
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1917 (((type x w32 mac) (class color)) |
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1918 :background "grey75") |
25090
4cd409210c7f
(toolbar): Add face definition for mono displays.
Gerd Moellmann <gerd@gnu.org>
parents:
25070
diff
changeset
|
1919 (((type x) (class mono)) |
54574
76b831799f4d
(read-face-font): Don't cons up unnecessarily.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54161
diff
changeset
|
1920 :background "grey")) |
25542
047532b73119
(tool-bar): Change face `toolbar' to `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25494
diff
changeset
|
1921 "Basic tool-bar face." |
25687
afad62240679
(mode-line, header-line, tool-bar, ): Add :version.
Dave Love <fx@gnu.org>
parents:
25650
diff
changeset
|
1922 :version "21.1" |
25012 | 1923 :group 'basic-faces) |
1924 | |
1925 | |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1926 (defface minibuffer-prompt '((((background dark)) :foreground "cyan") |
60162
82eaf594d12a
(escape-glyph, minibuffer-prompt, button): Add commentary for
Eli Zaretskii <eliz@gnu.org>
parents:
59996
diff
changeset
|
1927 ;; Don't use blue because many users of |
82eaf594d12a
(escape-glyph, minibuffer-prompt, button): Add commentary for
Eli Zaretskii <eliz@gnu.org>
parents:
59996
diff
changeset
|
1928 ;; the MS-DOS port customize their |
82eaf594d12a
(escape-glyph, minibuffer-prompt, button): Add commentary for
Eli Zaretskii <eliz@gnu.org>
parents:
59996
diff
changeset
|
1929 ;; foreground color to be blue. |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1930 (((type pc)) :foreground "magenta") |
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1931 (t :foreground "dark blue")) |
42298
d020b569f212
(minibuffer-prompt): New face.
Richard M. Stallman <rms@gnu.org>
parents:
40456
diff
changeset
|
1932 "Face for minibuffer prompts." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59872
diff
changeset
|
1933 :version "22.1" |
42298
d020b569f212
(minibuffer-prompt): New face.
Richard M. Stallman <rms@gnu.org>
parents:
40456
diff
changeset
|
1934 :group 'basic-faces) |
d020b569f212
(minibuffer-prompt): New face.
Richard M. Stallman <rms@gnu.org>
parents:
40456
diff
changeset
|
1935 |
d020b569f212
(minibuffer-prompt): New face.
Richard M. Stallman <rms@gnu.org>
parents:
40456
diff
changeset
|
1936 (setq minibuffer-prompt-properties |
d020b569f212
(minibuffer-prompt): New face.
Richard M. Stallman <rms@gnu.org>
parents:
40456
diff
changeset
|
1937 (append minibuffer-prompt-properties (list 'face 'minibuffer-prompt))) |
d020b569f212
(minibuffer-prompt): New face.
Richard M. Stallman <rms@gnu.org>
parents:
40456
diff
changeset
|
1938 |
25012 | 1939 (defface region |
54151
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1940 '((((class color) (min-colors 88) (background dark)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1941 :background "blue3") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1942 (((class color) (min-colors 88) (background light)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1943 :background "lightgoldenrod2") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1944 (((class color) (min-colors 16) (background dark)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1945 :background "blue3") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1946 (((class color) (min-colors 16) (background light)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1947 :background "lightgoldenrod2") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
1948 (((class color) (min-colors 8)) |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1949 :background "blue" :foreground "white") |
25012 | 1950 (((type tty) (class mono)) |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1951 :inverse-video t) |
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1952 (t :background "gray")) |
25947 | 1953 "Basic face for highlighting the region." |
31528
a461cad7a942
(face-x-resources): Make custom type more specific.
Dave Love <fx@gnu.org>
parents:
31500
diff
changeset
|
1954 :version "21.1" |
25012 | 1955 :group 'basic-faces) |
1956 | |
1957 | |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1958 (defface fringe |
29943
b8314fd10792
(fringe): Change face for different backgrounds.
Gerd Moellmann <gerd@gnu.org>
parents:
29880
diff
changeset
|
1959 '((((class color) (background light)) |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1960 :background "grey95") |
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1961 (((class color) (background dark)) |
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1962 :background "grey10") |
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1963 (t |
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
1964 :background "gray")) |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1965 "Basic face for the fringes to the left and right of windows under X." |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1966 :version "21.1" |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1967 :group 'frames |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1968 :group 'basic-faces) |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1969 |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1970 |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1971 (defface scroll-bar '() |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1972 "Basic face for the scroll bar colors under X." |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1973 :version "21.1" |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1974 :group 'frames |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1975 :group 'basic-faces) |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1976 |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1977 |
25887
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1978 (defface menu |
33756
b7c2175f13ac
(menu): Make inverse-video on ttys too.
Miles Bader <miles@gnu.org>
parents:
33507
diff
changeset
|
1979 '((((type tty)) |
b7c2175f13ac
(menu): Make inverse-video on ttys too.
Miles Bader <miles@gnu.org>
parents:
33507
diff
changeset
|
1980 :inverse-video t) |
b7c2175f13ac
(menu): Make inverse-video on ttys too.
Miles Bader <miles@gnu.org>
parents:
33507
diff
changeset
|
1981 (((type x-toolkit)) |
b7c2175f13ac
(menu): Make inverse-video on ttys too.
Miles Bader <miles@gnu.org>
parents:
33507
diff
changeset
|
1982 ) |
b7c2175f13ac
(menu): Make inverse-video on ttys too.
Miles Bader <miles@gnu.org>
parents:
33507
diff
changeset
|
1983 (t |
b7c2175f13ac
(menu): Make inverse-video on ttys too.
Miles Bader <miles@gnu.org>
parents:
33507
diff
changeset
|
1984 :inverse-video t)) |
37294 | 1985 "Basic face for the font and colors of the menu bar and popup menus." |
25887
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1986 :version "21.1" |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1987 :group 'menu |
25887
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1988 :group 'basic-faces) |
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1989 |
099a3776ff00
(face-spec-set-match-display): Recognize `type' of
Gerd Moellmann <gerd@gnu.org>
parents:
25814
diff
changeset
|
1990 |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1991 (defface border '() |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1992 "Basic face for the frame border under X." |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1993 :version "21.1" |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
1994 :group 'frames |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1995 :group 'basic-faces) |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1996 |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1997 |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
1998 (defface cursor '() |
57105
8f14c8ea51a1
(cursor): Add face-no-inherit property. Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
55902
diff
changeset
|
1999 "Basic face for the cursor color under X. |
8f14c8ea51a1
(cursor): Add face-no-inherit property. Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
55902
diff
changeset
|
2000 Note: Other faces cannot inherit from the cursor face." |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
2001 :version "21.1" |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
2002 :group 'cursor |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
2003 :group 'basic-faces) |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
2004 |
57105
8f14c8ea51a1
(cursor): Add face-no-inherit property. Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
55902
diff
changeset
|
2005 (put 'cursor 'face-no-inherit t) |
25588
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
2006 |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
2007 (defface mouse '() |
1d8ba3dd04e9
(face-set-after-frame-default): Initialize some
Gerd Moellmann <gerd@gnu.org>
parents:
25561
diff
changeset
|
2008 "Basic face for the mouse color under X." |
25137 | 2009 :version "21.1" |
27716
a3d981ee3185
Don't require custom. Add more specific :groups to various deffaces.
Dave Love <fx@gnu.org>
parents:
27571
diff
changeset
|
2010 :group 'mouse |
25012 | 2011 :group 'basic-faces) |
2012 | |
2013 | |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
2014 (defface bold '((t :weight bold)) |
25012 | 2015 "Basic bold face." |
2016 :group 'basic-faces) | |
2017 | |
2018 | |
45722
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
2019 (defface italic |
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
2020 '((((supports :slant italic)) |
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
2021 :slant italic) |
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
2022 (((supports :underline t)) |
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
2023 :underline t) |
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
2024 (t |
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
2025 ;; default to italic, even it doesn't appear to be supported, |
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
2026 ;; because in some cases the display engine will do it's own |
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
2027 ;; workaround (to `dim' on ttys) |
c553d91619aa
(display-supports-face-attributes-p): Work correctly if DISPLAY is a frame.
Miles Bader <miles@gnu.org>
parents:
45717
diff
changeset
|
2028 :slant italic)) |
25012 | 2029 "Basic italic font." |
2030 :group 'basic-faces) | |
2031 | |
2032 | |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
2033 (defface bold-italic '((t :weight bold :slant italic)) |
25012 | 2034 "Basic bold-italic face." |
2035 :group 'basic-faces) | |
2036 | |
2037 | |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
2038 (defface underline '((t :underline t)) |
25012 | 2039 "Basic underlined face." |
2040 :group 'basic-faces) | |
2041 | |
2042 | |
2043 (defface highlight | |
54151
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2044 '((((class color) (min-colors 88) (background light)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2045 :background "darkseagreen2") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2046 (((class color) (min-colors 88) (background dark)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2047 :background "darkolivegreen") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2048 (((class color) (min-colors 16) (background light)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2049 :background "darkseagreen2") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2050 (((class color) (min-colors 16) (background dark)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2051 :background "darkolivegreen") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2052 (((class color) (min-colors 8)) |
44590
59d5728240b3
(highlight): Force foreground to be black on a tty, so this face is
Miles Bader <miles@gnu.org>
parents:
43711
diff
changeset
|
2053 :background "green" :foreground "black") |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
2054 (t :inverse-video t)) |
25687
afad62240679
(mode-line, header-line, tool-bar, ): Add :version.
Dave Love <fx@gnu.org>
parents:
25650
diff
changeset
|
2055 "Basic face for highlighting." |
afad62240679
(mode-line, header-line, tool-bar, ): Add :version.
Dave Love <fx@gnu.org>
parents:
25650
diff
changeset
|
2056 :group 'basic-faces) |
25012 | 2057 |
2058 | |
2059 (defface secondary-selection | |
54151
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2060 '((((class color) (min-colors 88) (background light)) |
61481
d4014c213e7e
* term.el (term-ansi-current-bold, term-ansi-current-underline)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
60495
diff
changeset
|
2061 :background "yellow1") |
54151
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2062 (((class color) (min-colors 88) (background dark)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2063 :background "SkyBlue4") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2064 (((class color) (min-colors 16) (background light)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2065 :background "yellow") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2066 (((class color) (min-colors 16) (background dark)) |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2067 :background "SkyBlue4") |
9a5c3b661a40
(face-spec-set-match-display): Add a new attribute, `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
52401
diff
changeset
|
2068 (((class color) (min-colors 8)) |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
2069 :background "cyan" :foreground "black") |
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
2070 (t :inverse-video t)) |
25687
afad62240679
(mode-line, header-line, tool-bar, ): Add :version.
Dave Love <fx@gnu.org>
parents:
25650
diff
changeset
|
2071 "Basic face for displaying the secondary selection." |
afad62240679
(mode-line, header-line, tool-bar, ): Add :version.
Dave Love <fx@gnu.org>
parents:
25650
diff
changeset
|
2072 :group 'basic-faces) |
25012 | 2073 |
2074 | |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
2075 (defface fixed-pitch '((t :family "courier")) |
25012 | 2076 "The basic fixed-pitch face." |
2077 :group 'basic-faces) | |
2078 | |
2079 | |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
2080 (defface variable-pitch '((t :family "helv")) |
25012 | 2081 "The basic variable-pitch face." |
2082 :group 'basic-faces) | |
2083 | |
2084 | |
2085 (defface trailing-whitespace | |
2086 '((((class color) (background light)) | |
61481
d4014c213e7e
* term.el (term-ansi-current-bold, term-ansi-current-underline)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
60495
diff
changeset
|
2087 :background "red1") |
25012 | 2088 (((class color) (background dark)) |
61481
d4014c213e7e
* term.el (term-ansi-current-bold, term-ansi-current-underline)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
60495
diff
changeset
|
2089 :background "red1") |
43711
d15360503e4e
(face-spec-choose): Allow `t' to appear before the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43550
diff
changeset
|
2090 (t :inverse-video t)) |
25687
afad62240679
(mode-line, header-line, tool-bar, ): Add :version.
Dave Love <fx@gnu.org>
parents:
25650
diff
changeset
|
2091 "Basic face for highlighting trailing whitespace." |
afad62240679
(mode-line, header-line, tool-bar, ): Add :version.
Dave Love <fx@gnu.org>
parents:
25650
diff
changeset
|
2092 :version "21.1" |
62386
3eeae124dcab
(describe-face): Output a definition link button.
Richard M. Stallman <rms@gnu.org>
parents:
61481
diff
changeset
|
2093 :group 'whitespace ; like `show-trailing-whitespace' |
25687
afad62240679
(mode-line, header-line, tool-bar, ): Add :version.
Dave Love <fx@gnu.org>
parents:
25650
diff
changeset
|
2094 :group 'basic-faces) |
25012 | 2095 |
63050
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2096 (defface escape-glyph |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2097 '((((background dark)) :foreground "pink2") |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2098 ;; See the comment in minibuffer-prompt for |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2099 ;; the reason not to use blue on MS-DOS. |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2100 (((type pc)) :foreground "magenta") |
63137
08283a69b880
(escape-glyph): Use blue once again in last case.
Richard M. Stallman <rms@gnu.org>
parents:
63050
diff
changeset
|
2101 ;; red4 is too light -- rms. |
08283a69b880
(escape-glyph): Use blue once again in last case.
Richard M. Stallman <rms@gnu.org>
parents:
63050
diff
changeset
|
2102 (t :foreground "blue")) |
59054
a32a0ec1c9ac
(escape-glyph): Use blue against light foreground.
Richard M. Stallman <rms@gnu.org>
parents:
58935
diff
changeset
|
2103 "Face for characters displayed as ^-sequences or \-sequences." |
63050
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2104 :group 'basic-faces |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2105 :version "22.1") |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2106 |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2107 (defface no-break-space |
63140
bd94b75dbfe8
(no-break-space): Test `class' before `min-colors'
Richard M. Stallman <rms@gnu.org>
parents:
63137
diff
changeset
|
2108 '((((class color) (min-colors 88)) :inherit escape-glyph :underline t) |
bd94b75dbfe8
(no-break-space): Test `class' before `min-colors'
Richard M. Stallman <rms@gnu.org>
parents:
63137
diff
changeset
|
2109 (((class color) (min-colors 8)) :background "magenta" :foreground ) |
63137
08283a69b880
(escape-glyph): Use blue once again in last case.
Richard M. Stallman <rms@gnu.org>
parents:
63050
diff
changeset
|
2110 (t :inverse-video t)) |
63050
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2111 "Face for non-breaking space." |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2112 :group 'basic-faces |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2113 :version "22.1") |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2114 |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2115 (defface shadow |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2116 '((((background dark)) :foreground "grey70") |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2117 (((background light)) :foreground "grey50")) |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2118 "Basic face for shadowed text." |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2119 :group 'basic-faces |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2120 :version "22.1") |
a05421095dca
(no-break-space, shadow): New faces.
Juri Linkov <juri@jurta.org>
parents:
62968
diff
changeset
|
2121 |
25012 | 2122 |
2123 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2124 ;;; Manipulating font names. | |
2125 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
2126 | |
2127 ;; This is here for compatibilty with Emacs 20.2. For example, | |
28907 | 2128 ;; international/fontset.el uses x-resolve-font-name. The following |
2129 ;; functions are not used in the face implementation itself. | |
2456 | 2130 |
16687
049c87a96dca
Change defconsts to defvars.
Richard M. Stallman <rms@gnu.org>
parents:
16590
diff
changeset
|
2131 (defvar x-font-regexp nil) |
049c87a96dca
Change defconsts to defvars.
Richard M. Stallman <rms@gnu.org>
parents:
16590
diff
changeset
|
2132 (defvar x-font-regexp-head nil) |
049c87a96dca
Change defconsts to defvars.
Richard M. Stallman <rms@gnu.org>
parents:
16590
diff
changeset
|
2133 (defvar x-font-regexp-weight nil) |
049c87a96dca
Change defconsts to defvars.
Richard M. Stallman <rms@gnu.org>
parents:
16590
diff
changeset
|
2134 (defvar x-font-regexp-slant nil) |
2456 | 2135 |
12668
7660e82d0346
(x-font-regexp-weight-subnum, x-font-regexp-slant-subnum)
Karl Heuer <kwzh@gnu.org>
parents:
12651
diff
changeset
|
2136 (defconst x-font-regexp-weight-subnum 1) |
7660e82d0346
(x-font-regexp-weight-subnum, x-font-regexp-slant-subnum)
Karl Heuer <kwzh@gnu.org>
parents:
12651
diff
changeset
|
2137 (defconst x-font-regexp-slant-subnum 2) |
7660e82d0346
(x-font-regexp-weight-subnum, x-font-regexp-slant-subnum)
Karl Heuer <kwzh@gnu.org>
parents:
12651
diff
changeset
|
2138 (defconst x-font-regexp-swidth-subnum 3) |
7660e82d0346
(x-font-regexp-weight-subnum, x-font-regexp-slant-subnum)
Karl Heuer <kwzh@gnu.org>
parents:
12651
diff
changeset
|
2139 (defconst x-font-regexp-adstyle-subnum 4) |
7660e82d0346
(x-font-regexp-weight-subnum, x-font-regexp-slant-subnum)
Karl Heuer <kwzh@gnu.org>
parents:
12651
diff
changeset
|
2140 |
2456 | 2141 ;;; Regexps matching font names in "Host Portable Character Representation." |
2142 ;;; | |
2143 (let ((- "[-?]") | |
2144 (foundry "[^-]+") | |
2145 (family "[^-]+") | |
2146 (weight "\\(bold\\|demibold\\|medium\\)") ; 1 | |
2147 ; (weight\? "\\(\\*\\|bold\\|demibold\\|medium\\|\\)") ; 1 | |
2148 (weight\? "\\([^-]*\\)") ; 1 | |
2149 (slant "\\([ior]\\)") ; 2 | |
2150 ; (slant\? "\\([ior?*]?\\)") ; 2 | |
2151 (slant\? "\\([^-]?\\)") ; 2 | |
2152 ; (swidth "\\(\\*\\|normal\\|semicondensed\\|\\)") ; 3 | |
2153 (swidth "\\([^-]*\\)") ; 3 | |
2154 ; (adstyle "\\(\\*\\|sans\\|\\)") ; 4 | |
12690
e2d3fa52d100
(x-font-regexp): Add \\(\\) for substring extraction.
Karl Heuer <kwzh@gnu.org>
parents:
12668
diff
changeset
|
2155 (adstyle "\\([^-]*\\)") ; 4 |
2456 | 2156 (pixelsize "[0-9]+") |
2157 (pointsize "[0-9][0-9]+") | |
2158 (resx "[0-9][0-9]+") | |
2159 (resy "[0-9][0-9]+") | |
2160 (spacing "[cmp?*]") | |
2161 (avgwidth "[0-9]+") | |
2162 (registry "[^-]+") | |
2163 (encoding "[^-]+") | |
2164 ) | |
2165 (setq x-font-regexp | |
2166 (concat "\\`\\*?[-?*]" | |
2167 foundry - family - weight\? - slant\? - swidth - adstyle - | |
12475
eb436b0c4ab3
(x-font-regexp): Include the avgwidth.
Richard M. Stallman <rms@gnu.org>
parents:
12460
diff
changeset
|
2168 pixelsize - pointsize - resx - resy - spacing - avgwidth - |
eb436b0c4ab3
(x-font-regexp): Include the avgwidth.
Richard M. Stallman <rms@gnu.org>
parents:
12460
diff
changeset
|
2169 registry - encoding "\\*?\\'" |
2456 | 2170 )) |
2171 (setq x-font-regexp-head | |
2172 (concat "\\`[-?*]" foundry - family - weight\? - slant\? | |
2173 "\\([-*?]\\|\\'\\)")) | |
2174 (setq x-font-regexp-slant (concat - slant -)) | |
2175 (setq x-font-regexp-weight (concat - weight -)) | |
28840 | 2176 nil) |
2456 | 2177 |
25012 | 2178 |
3071
68de05fb5751
* faces.el (set-face-font): Call x-resolve-font-name on the font
Jim Blandy <jimb@redhat.com>
parents:
3049
diff
changeset
|
2179 (defun x-resolve-font-name (pattern &optional face frame) |
68de05fb5751
* faces.el (set-face-font): Call x-resolve-font-name on the font
Jim Blandy <jimb@redhat.com>
parents:
3049
diff
changeset
|
2180 "Return a font name matching PATTERN. |
28849
76e727bc0dfd
Fix make-obsolete for internal-get-face.
Dave Love <fx@gnu.org>
parents:
28840
diff
changeset
|
2181 All wildcards in PATTERN are instantiated. |
3130
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
2182 If PATTERN is nil, return the name of the frame's base font, which never |
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
2183 contains wildcards. |
10170
5fc240a3e4a0
(face-initialize): Test for framep not t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
10107
diff
changeset
|
2184 Given optional arguments FACE and FRAME, return a font which is |
5fc240a3e4a0
(face-initialize): Test for framep not t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
10107
diff
changeset
|
2185 also the same size as FACE on FRAME, or fail." |
3233
28b2df35c33e
(x-resolve-font-name): Allow symbol as FACE arg.
Richard M. Stallman <rms@gnu.org>
parents:
3182
diff
changeset
|
2186 (or (symbolp face) |
28b2df35c33e
(x-resolve-font-name): Allow symbol as FACE arg.
Richard M. Stallman <rms@gnu.org>
parents:
3182
diff
changeset
|
2187 (setq face (face-name face))) |
28b2df35c33e
(x-resolve-font-name): Allow symbol as FACE arg.
Richard M. Stallman <rms@gnu.org>
parents:
3182
diff
changeset
|
2188 (and (eq frame t) |
28b2df35c33e
(x-resolve-font-name): Allow symbol as FACE arg.
Richard M. Stallman <rms@gnu.org>
parents:
3182
diff
changeset
|
2189 (setq frame nil)) |
3130
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
2190 (if pattern |
5092
36508a7c0a3f
(x-resolve-font-name): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
5081
diff
changeset
|
2191 ;; Note that x-list-fonts has code to handle a face with nil as its font. |
16002
c8cbde1d3f11
(internal-set-face-1): When calling x-list-fonts, ask for just one match.
Richard M. Stallman <rms@gnu.org>
parents:
15884
diff
changeset
|
2192 (let ((fonts (x-list-fonts pattern face frame 1))) |
3130
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
2193 (or fonts |
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
2194 (if face |
10584 | 2195 (if (string-match "\\*" pattern) |
2196 (if (null (face-font face)) | |
2197 (error "No matching fonts are the same height as the frame default font") | |
2198 (error "No matching fonts are the same height as face `%s'" face)) | |
2199 (if (null (face-font face)) | |
2200 (error "Height of font `%s' doesn't match the frame default font" | |
2201 pattern) | |
2202 (error "Height of font `%s' doesn't match face `%s'" | |
2203 pattern face))) | |
3353
8cbd38886eef
(x-resolve-font-name): Clean up error messages.
Richard M. Stallman <rms@gnu.org>
parents:
3298
diff
changeset
|
2204 (error "No fonts match `%s'" pattern))) |
3130
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
2205 (car fonts)) |
82c29bacb6b3
* faces.el (x-resolve-font-name): If PATTERN is nil, return the
Jim Blandy <jimb@redhat.com>
parents:
3071
diff
changeset
|
2206 (cdr (assq 'font (frame-parameters (selected-frame)))))) |
3071
68de05fb5751
* faces.el (set-face-font): Call x-resolve-font-name on the font
Jim Blandy <jimb@redhat.com>
parents:
3049
diff
changeset
|
2207 |
25012 | 2208 |
2456 | 2209 (defun x-frob-font-weight (font which) |
13704
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2210 (let ((case-fold-search t)) |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2211 (cond ((string-match x-font-regexp font) |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2212 (concat (substring font 0 |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2213 (match-beginning x-font-regexp-weight-subnum)) |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2214 which |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2215 (substring font (match-end x-font-regexp-weight-subnum) |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2216 (match-beginning x-font-regexp-adstyle-subnum)) |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2217 ;; Replace the ADD_STYLE_NAME field with * |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2218 ;; because the info in it may not be the same |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2219 ;; for related fonts. |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2220 "*" |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2221 (substring font (match-end x-font-regexp-adstyle-subnum)))) |
14880
b405f39b5493
(x-frob-font-slant): Properly handle a match against
Richard M. Stallman <rms@gnu.org>
parents:
14409
diff
changeset
|
2222 ((string-match x-font-regexp-head font) |
b405f39b5493
(x-frob-font-slant): Properly handle a match against
Richard M. Stallman <rms@gnu.org>
parents:
14409
diff
changeset
|
2223 (concat (substring font 0 (match-beginning 1)) which |
b405f39b5493
(x-frob-font-slant): Properly handle a match against
Richard M. Stallman <rms@gnu.org>
parents:
14409
diff
changeset
|
2224 (substring font (match-end 1)))) |
b405f39b5493
(x-frob-font-slant): Properly handle a match against
Richard M. Stallman <rms@gnu.org>
parents:
14409
diff
changeset
|
2225 ((string-match x-font-regexp-weight font) |
13704
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2226 (concat (substring font 0 (match-beginning 1)) which |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2227 (substring font (match-end 1))))))) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
2228 (make-obsolete 'x-frob-font-weight 'make-face-... "21.1") |
25012 | 2229 |
2456 | 2230 (defun x-frob-font-slant (font which) |
13704
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2231 (let ((case-fold-search t)) |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2232 (cond ((string-match x-font-regexp font) |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2233 (concat (substring font 0 |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2234 (match-beginning x-font-regexp-slant-subnum)) |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2235 which |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2236 (substring font (match-end x-font-regexp-slant-subnum) |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2237 (match-beginning x-font-regexp-adstyle-subnum)) |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2238 ;; Replace the ADD_STYLE_NAME field with * |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2239 ;; because the info in it may not be the same |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2240 ;; for related fonts. |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2241 "*" |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2242 (substring font (match-end x-font-regexp-adstyle-subnum)))) |
14880
b405f39b5493
(x-frob-font-slant): Properly handle a match against
Richard M. Stallman <rms@gnu.org>
parents:
14409
diff
changeset
|
2243 ((string-match x-font-regexp-head font) |
b405f39b5493
(x-frob-font-slant): Properly handle a match against
Richard M. Stallman <rms@gnu.org>
parents:
14409
diff
changeset
|
2244 (concat (substring font 0 (match-beginning 2)) which |
b405f39b5493
(x-frob-font-slant): Properly handle a match against
Richard M. Stallman <rms@gnu.org>
parents:
14409
diff
changeset
|
2245 (substring font (match-end 2)))) |
b405f39b5493
(x-frob-font-slant): Properly handle a match against
Richard M. Stallman <rms@gnu.org>
parents:
14409
diff
changeset
|
2246 ((string-match x-font-regexp-slant font) |
13704
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2247 (concat (substring font 0 (match-beginning 1)) which |
3dcaddea344a
Wrap case-fold-search for x-frob-font-weight and x-frob-font-slant.
Simon Marshall <simon@gnu.org>
parents:
13609
diff
changeset
|
2248 (substring font (match-end 1))))))) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
2249 (make-obsolete 'x-frob-font-slant 'make-face-... "21.1") |
25012 | 2250 |
40351
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2251 ;; These aliases are here so that we don't get warnings about obsolete |
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2252 ;; functions from the byte compiler. |
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2253 (defalias 'internal-frob-font-weight 'x-frob-font-weight) |
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2254 (defalias 'internal-frob-font-slant 'x-frob-font-slant) |
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2255 |
2456 | 2256 (defun x-make-font-bold (font) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2257 "Given an X font specification, make a bold version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2258 If that can't be done, return nil." |
40351
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2259 (internal-frob-font-weight font "bold")) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
2260 (make-obsolete 'x-make-font-bold 'make-face-bold "21.1") |
25012 | 2261 |
2456 | 2262 (defun x-make-font-demibold (font) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2263 "Given an X font specification, make a demibold version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2264 If that can't be done, return nil." |
40351
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2265 (internal-frob-font-weight font "demibold")) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
2266 (make-obsolete 'x-make-font-demibold 'make-face-bold "21.1") |
25012 | 2267 |
2456 | 2268 (defun x-make-font-unbold (font) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2269 "Given an X font specification, make a non-bold version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2270 If that can't be done, return nil." |
40351
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2271 (internal-frob-font-weight font "medium")) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
2272 (make-obsolete 'x-make-font-unbold 'make-face-unbold "21.1") |
25012 | 2273 |
2456 | 2274 (defun x-make-font-italic (font) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2275 "Given an X font specification, make an italic version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2276 If that can't be done, return nil." |
40351
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2277 (internal-frob-font-slant font "i")) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
2278 (make-obsolete 'x-make-font-italic 'make-face-italic "21.1") |
25012 | 2279 |
2456 | 2280 (defun x-make-font-oblique (font) ; you say tomayto... |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2281 "Given an X font specification, make an oblique version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2282 If that can't be done, return nil." |
40351
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2283 (internal-frob-font-slant font "o")) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
2284 (make-obsolete 'x-make-font-oblique 'make-face-italic "21.1") |
25012 | 2285 |
2456 | 2286 (defun x-make-font-unitalic (font) |
4439
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2287 "Given an X font specification, make a non-italic version of it. |
e7ab04f23df5
Make boldness and italicness affect subsequently created frames.
Richard M. Stallman <rms@gnu.org>
parents:
4122
diff
changeset
|
2288 If that can't be done, return nil." |
40351
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2289 (internal-frob-font-slant font "r")) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
2290 (make-obsolete 'x-make-font-unitalic 'make-face-unitalic "21.1") |
25012 | 2291 |
17752
2687f3d7c191
(x-make-font-bold-italic): New function.
Kenichi Handa <handa@m17n.org>
parents:
17560
diff
changeset
|
2292 (defun x-make-font-bold-italic (font) |
2687f3d7c191
(x-make-font-bold-italic): New function.
Kenichi Handa <handa@m17n.org>
parents:
17560
diff
changeset
|
2293 "Given an X font specification, make a bold and italic version of it. |
2687f3d7c191
(x-make-font-bold-italic): New function.
Kenichi Handa <handa@m17n.org>
parents:
17560
diff
changeset
|
2294 If that can't be done, return nil." |
40351
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2295 (and (setq font (internal-frob-font-weight font "bold")) |
a44d4a7dd8de
(internal-get-face): Use facep instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
39830
diff
changeset
|
2296 (internal-frob-font-slant font "i"))) |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28907
diff
changeset
|
2297 (make-obsolete 'x-make-font-bold-italic 'make-face-bold-italic "21.1") |
2456 | 2298 |
2715
9caee9338229
* faces.el: Call internal-set-face-1, not internat-set-face-1.
Jim Blandy <jimb@redhat.com>
parents:
2714
diff
changeset
|
2299 (provide 'faces) |
9caee9338229
* faces.el: Call internal-set-face-1, not internat-set-face-1.
Jim Blandy <jimb@redhat.com>
parents:
2714
diff
changeset
|
2300 |
63382
9cbfa983c1cf
(read-face-name): Use complete-in-turn complete non-aliases
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63311
diff
changeset
|
2301 ;; arch-tag: 19a4759f-2963-445f-b004-425b9aadd7d6 |
28840 | 2302 ;;; faces.el ends here |