annotate lisp/cus-face.el @ 19263:9d34beb088bf

(make-coding-system): Add a new FLAGS elements SAFE. Use it for terminal coding system if some other coding system is specified explicitly. (ignore-relative-composition): Initialize it.
author Kenichi Handa <handa@m17n.org>
date Sun, 10 Aug 1997 04:07:03 +0000
parents e487ed925a50
children a2327a135fe7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
1 ;;; cus-face.el -- customization support for faces.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3 ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
6 ;; Keywords: help, faces
17568
65f85125b4f2 Changed version number.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17567
diff changeset
7 ;; Version: Emacs
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
8 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
9
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
10 ;; This file is part of GNU Emacs.
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
11
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
15 ;; any later version.
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
16
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
20 ;; GNU General Public License for more details.
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
21
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
22 ;; You should have received a copy of the GNU General Public License
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
25 ;; Boston, MA 02111-1307, USA.
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
26
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
27 ;;; Commentary:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
28 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
29 ;; See `custom.el'.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
30
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
31 ;;; Code:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
32
17856
1e5f1a1f0db3 (custom-facep): Defined (once again).
Richard M. Stallman <rms@gnu.org>
parents: 17568
diff changeset
33 (defalias 'custom-facep
1e5f1a1f0db3 (custom-facep): Defined (once again).
Richard M. Stallman <rms@gnu.org>
parents: 17568
diff changeset
34 (if (fboundp 'facep) 'facep
1e5f1a1f0db3 (custom-facep): Defined (once again).
Richard M. Stallman <rms@gnu.org>
parents: 17568
diff changeset
35 '(lambda (face) nil)))
1e5f1a1f0db3 (custom-facep): Defined (once again).
Richard M. Stallman <rms@gnu.org>
parents: 17568
diff changeset
36
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
37 ;;; Declaring a face.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
38
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
39 ;;;###autoload
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
40 (defun custom-declare-face (face spec doc &rest args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
41 "Like `defface', but FACE is evaluated as a normal argument."
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
42 (unless (get face 'face-defface-spec)
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
43 (put face 'face-defface-spec spec)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
44 (when (fboundp 'facep)
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
45 (unless (facep face)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
46 ;; If the user has already created the face, respect that.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
47 (let ((value (or (get face 'saved-face) spec))
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
48 (frames (frame-list))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
49 frame)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
50 ;; Create global face.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
51 (make-empty-face face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
52 ;; Create frame local faces
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
53 (while frames
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
54 (setq frame (car frames)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
55 frames (cdr frames))
19257
e487ed925a50 (custom-declare-face): Call make-face-x-resource-internal.
Richard M. Stallman <rms@gnu.org>
parents: 18935
diff changeset
56 (face-spec-set face value frame)))
e487ed925a50 (custom-declare-face): Call make-face-x-resource-internal.
Richard M. Stallman <rms@gnu.org>
parents: 18935
diff changeset
57 ;; When making a face after frames already exist
e487ed925a50 (custom-declare-face): Call make-face-x-resource-internal.
Richard M. Stallman <rms@gnu.org>
parents: 18935
diff changeset
58 (if (memq window-system '(x w32))
e487ed925a50 (custom-declare-face): Call make-face-x-resource-internal.
Richard M. Stallman <rms@gnu.org>
parents: 18935
diff changeset
59 (make-face-x-resource-internal face))))
18935
ab4cd3135797 (custom-declare-face): Use [set-]face-documentation.
Richard M. Stallman <rms@gnu.org>
parents: 18599
diff changeset
60 (when (and doc (null (face-documentation face)))
ab4cd3135797 (custom-declare-face): Use [set-]face-documentation.
Richard M. Stallman <rms@gnu.org>
parents: 18599
diff changeset
61 (set-face-documentation face doc))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
62 (custom-handle-all-keywords face args 'custom-face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
63 (run-hooks 'custom-define-hook))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
64 face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
65
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
66 ;;; Font Attributes.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
67
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
68 (defconst custom-face-attributes
18257
34f1f8c5eda3 Use booleans.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17946
diff changeset
69 '((:bold (boolean :tag "Bold"
34f1f8c5eda3 Use booleans.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17946
diff changeset
70 :help-echo "Control whether a bold font should be used.")
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
71 set-face-bold-p
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
72 face-bold-p)
18257
34f1f8c5eda3 Use booleans.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17946
diff changeset
73 (:italic (boolean :tag "Italic"
34f1f8c5eda3 Use booleans.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17946
diff changeset
74 :help-echo "\
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
75 Control whether an italic font should be used.")
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
76 set-face-italic-p
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
77 face-italic-p)
18257
34f1f8c5eda3 Use booleans.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17946
diff changeset
78 (:underline (boolean :tag "Underline"
34f1f8c5eda3 Use booleans.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17946
diff changeset
79 :help-echo "\
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
80 Control whether the text should be underlined.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
81 set-face-underline-p
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
82 face-underline-p)
18257
34f1f8c5eda3 Use booleans.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17946
diff changeset
83 (:inverse-video (boolean :tag "Inverse Video"
34f1f8c5eda3 Use booleans.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17946
diff changeset
84 :help-echo "\
17946
2b225f00d308 (custom-face-attributes): Add :inverse-video.
Richard M. Stallman <rms@gnu.org>
parents: 17856
diff changeset
85 Control whether the text should be in inverse video.")
2b225f00d308 (custom-face-attributes): Add :inverse-video.
Richard M. Stallman <rms@gnu.org>
parents: 17856
diff changeset
86 set-face-inverse-video-p
2b225f00d308 (custom-face-attributes): Add :inverse-video.
Richard M. Stallman <rms@gnu.org>
parents: 17856
diff changeset
87 face-inverse-video-p)
18599
bdb4c815ce21 Use `color' instead of `editable-color'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18573
diff changeset
88 (:foreground (color :tag "Foreground"
bdb4c815ce21 Use `color' instead of `editable-color'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18573
diff changeset
89 :value "black"
bdb4c815ce21 Use `color' instead of `editable-color'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18573
diff changeset
90 :help-echo "Set foreground color.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
91 set-face-foreground
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
92 face-foreground)
18599
bdb4c815ce21 Use `color' instead of `editable-color'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18573
diff changeset
93 (:background (color :tag "Background"
bdb4c815ce21 Use `color' instead of `editable-color'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18573
diff changeset
94 :value "white"
bdb4c815ce21 Use `color' instead of `editable-color'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18573
diff changeset
95 :help-echo "Set background color.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
96 set-face-background
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
97 face-background)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
98 (:stipple (editable-field :format "Stipple: %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
99 :help-echo "Name of background bitmap file.")
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
100 set-face-stipple
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
101 face-stipple))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
102 "Alist of face attributes.
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
103 The elements are of the form (KEY TYPE SET GET),
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
104 where KEY is the name of the attribute,
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
105 TYPE is a widget type for editing the attibute,
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
106 SET is a function for setting the attribute value,
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
107 and GET is a function for getiing the attribute value.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
108
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
109 The SET function should take three arguments, the face to modify, the
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
110 value of the attribute, and optionally the frame where the face should
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
111 be changed.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
112
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
113 The GET function should take two arguments, the face to examine, and
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
114 optionally the frame where the face should be examined.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
115
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
116 (defun custom-face-attributes-get (face frame)
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
117 "For FACE on FRAME, return an alternating list describing its attributes.
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
118 The list has the form (KEYWORD VALUE KEYWORD VALUE...).
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
119 Each keyword should be listed in `custom-face-attributes'.
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
120 We include only those attributes that differ from the default face.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
121
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
122 If FRAME is nil, use the global defaults for FACE."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
123 (let ((atts custom-face-attributes)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
124 att result get)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
125 (while atts
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
126 (setq att (car atts)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
127 atts (cdr atts)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
128 get (nth 3 att))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
129 (when get
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
130 (let ((answer (funcall get face frame)))
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
131 (if (and (not (equal answer (funcall get 'default frame)))
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
132 (widget-apply (nth 1 att) :match answer))
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
133 (setq result (cons (nth 0 att) (cons answer result)))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
134 result))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
135
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
136 ;;; Initializing.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
137
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
138 ;;;###autoload
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
139 (defun custom-set-faces (&rest args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
140 "Initialize faces according to user preferences.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
141 The arguments should be a list where each entry has the form:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
142
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
143 (FACE SPEC [NOW])
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
144
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
145 SPEC is stored as the saved value for FACE.
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
146 If NOW is present and non-nil, FACE is created now, according to SPEC.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
147
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
148 See `defface' for the format of SPEC."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
149 (while args
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
150 (let ((entry (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
151 (if (listp entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
152 (let ((face (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
153 (spec (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
154 (now (nth 2 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
155 (put face 'saved-face spec)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
156 (when now
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
157 (put face 'force-face t))
17524
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
158 (when (or now (facep face))
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
159 (make-empty-face face)
8ba505704d9d Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
160 (face-spec-set face spec))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
161 (setq args (cdr args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
162 ;; Old format, a plist of FACE SPEC pairs.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
163 (let ((face (nth 0 args))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
164 (spec (nth 1 args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
165 (put face 'saved-face spec))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
166 (setq args (cdr (cdr args)))))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
167
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
168 ;;; The End.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
169
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
170 (provide 'cus-face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
171
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
172 ;; cus-face.el ends here