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