Mercurial > emacs
annotate lisp/cus-face.el @ 28923:dcafe3c9cd6c
(sh-while-getopts) <sh>: Handle case that
user-specified option string is empty.
| author | Gerd Moellmann <gerd@gnu.org> |
|---|---|
| date | Mon, 15 May 2000 20:14:39 +0000 |
| parents | 3251a6750150 |
| children | b332ebdca302 |
| 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 | 2 ;; |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
3 ;; Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. |
| 17334 | 4 ;; |
| 5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> | |
| 6 ;; Keywords: help, faces | |
|
17568
65f85125b4f2
Changed version number.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17567
diff
changeset
|
7 ;; Version: Emacs |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
8 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/ (probably obsolete) |
| 17334 | 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 | 27 ;;; Commentary: |
| 28 ;; | |
| 29 ;; See `custom.el'. | |
| 30 | |
| 31 ;;; Code: | |
| 32 | |
| 24984 | 33 (defalias 'custom-facep 'facep) |
|
17856
1e5f1a1f0db3
(custom-facep): Defined (once again).
Richard M. Stallman <rms@gnu.org>
parents:
17568
diff
changeset
|
34 |
| 17334 | 35 ;;; Declaring a face. |
| 36 | |
| 37 ;;;###autoload | |
| 38 (defun custom-declare-face (face spec doc &rest args) | |
| 39 "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
|
40 (unless (get face 'face-defface-spec) |
|
8ba505704d9d
Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
41 (put face 'face-defface-spec spec) |
| 17334 | 42 (when (fboundp 'facep) |
|
17524
8ba505704d9d
Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
43 (unless (facep face) |
| 17334 | 44 ;; If the user has already created the face, respect that. |
| 45 (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
|
46 (frames (frame-list)) |
| 17334 | 47 frame) |
| 48 ;; Create global face. | |
| 49 (make-empty-face face) | |
| 50 ;; Create frame local faces | |
| 51 (while frames | |
| 52 (setq frame (car frames) | |
| 53 frames (cdr frames)) | |
|
19257
e487ed925a50
(custom-declare-face): Call make-face-x-resource-internal.
Richard M. Stallman <rms@gnu.org>
parents:
18935
diff
changeset
|
54 (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
|
55 ;; 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
|
56 (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
|
57 (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
|
58 (when (and doc (null (face-documentation face))) |
|
26583
3251a6750150
(custom-declare-face): Purecopy DOC.
Dave Love <fx@gnu.org>
parents:
25684
diff
changeset
|
59 (set-face-documentation face (purecopy doc))) |
| 17334 | 60 (custom-handle-all-keywords face args 'custom-face) |
| 61 (run-hooks 'custom-define-hook)) | |
| 62 face) | |
| 63 | |
| 24984 | 64 ;;; Face attributes. |
| 65 | |
| 66 ;; Below, nil is used in widget specifications for `unspecified' face | |
| 67 ;; attributes and `off' is used instead of nil attribute values. The | |
| 68 ;; reason for this is that nil corresponds to the result you get when | |
| 69 ;; looking up an attribute in a defface spec that isn't contained in | |
| 70 ;; the spec. | |
| 17334 | 71 |
| 72 (defconst custom-face-attributes | |
| 24984 | 73 '((:family |
| 74 (choice :tag "Font family" | |
| 75 :help-echo "Font family or fontset alias name." | |
| 76 (const :tag "*" nil) | |
| 77 (string :tag "Family")) | |
| 78 (lambda (face value &optional frame) | |
| 79 (set-face-attribute face frame :family (or value 'unspecified))) | |
| 80 (lambda (face &optional frame) | |
| 81 (let ((family (face-attribute face :family frame))) | |
| 82 (if (eq family 'unspecified) nil family)))) | |
| 83 | |
| 84 (:width | |
| 85 (choice :tag "Width" | |
| 86 :help-echo "Font width." | |
| 87 (const :tag "*" nil) | |
| 88 (const :tag "compressed" condensed) | |
| 89 (const :tag "condensed" condensed) | |
| 90 (const :tag "demiexpanded" semi-expanded) | |
| 91 (const :tag "expanded" expanded) | |
| 92 (const :tag "extracondensed" extra-condensed) | |
| 93 (const :tag "extraexpanded" extra-expanded) | |
| 94 (const :tag "medium" normal) | |
| 95 (const :tag "narrow" condensed) | |
| 96 (const :tag "normal" normal) | |
| 97 (const :tag "regular" normal) | |
| 98 (const :tag "semicondensed" semi-condensed) | |
| 99 (const :tag "semiexpanded" semi-expanded) | |
| 100 (const :tag "ultracondensed" ultra-condensed) | |
| 101 (const :tag "ultraexpanded" ultra-expanded) | |
| 102 (const :tag "wide" extra-expanded)) | |
| 103 (lambda (face value &optional frame) | |
| 104 (set-face-attribute face frame :width (or value 'unspecified))) | |
| 105 (lambda (face &optional frame) | |
| 106 (let ((width (face-attribute face :width frame))) | |
| 107 (if (eq width 'unspecified) nil width)))) | |
| 108 | |
| 109 (:height | |
| 110 (choice :tag "Height" | |
| 111 :help-echo "Face's font height." | |
| 112 (const :tag "*" nil) | |
| 113 (integer :tag "Height in 1/10 pt")) | |
| 114 (lambda (face value &optional frame) | |
| 115 (set-face-attribute face frame :height (or value 'unspecified))) | |
| 116 (lambda (face &optional frame) | |
| 117 (let ((height (face-attribute face :height frame))) | |
| 118 (if (eq height 'unspecified) nil height)))) | |
| 119 | |
| 120 (:weight | |
| 121 (choice :tag "Weight" | |
| 122 :help-echo "Font weight." | |
| 123 (const :tag "*" nil) | |
| 124 (const :tag "black" ultra_bold) | |
| 125 (const :tag "bold" bold) | |
| 126 (const :tag "book" semi-light) | |
| 127 (const :tag "demibold" semi-bold) | |
| 128 (const :tag "extralight" extra-light) | |
| 129 (const :tag "extrabold" extra-bold) | |
| 130 (const :tag "heavy" extra-bold) | |
| 131 (const :tag "light" light) | |
| 132 (const :tag "medium" normal) | |
| 133 (const :tag "normal" normal) | |
| 134 (const :tag "regular" normal) | |
| 135 (const :tag "semibold" semi-bold) | |
| 136 (const :tag "semilight" semi-light) | |
| 137 (const :tag "ultralight" ultra-light) | |
| 138 (const :tag "ultrabold" ultra-bold)) | |
| 139 (lambda (face value &optional frame) | |
| 140 (set-face-attribute face frame :weight (or value 'unspecified))) | |
| 141 (lambda (face &optional frame) | |
| 142 (let ((weight (face-attribute face :weight frame))) | |
| 143 (if (eq weight 'unspecified) nil weight)))) | |
| 144 | |
| 145 (:slant | |
| 146 (choice :tag "Slant" | |
| 147 :help-echo "Font slant." | |
| 148 (const :tag "*" nil) | |
| 149 (const :tag "italic" italic) | |
| 150 (const :tag "oblique" oblique) | |
| 151 (const :tag "normal" normal)) | |
| 152 (lambda (face value &optional frame) | |
| 153 (set-face-attribute face frame :slant (or value 'unspecified))) | |
| 154 (lambda (face &optional frame) | |
| 155 (let ((slant (face-attribute face :slant frame))) | |
| 156 (if (eq slant 'unspecified) nil slant)))) | |
| 157 | |
| 158 (:underline | |
| 159 (choice :tag "Underline" | |
| 160 :help-echo "Control text underlining." | |
| 161 (const :tag "*" nil) | |
| 162 (const :tag "On" t) | |
| 163 (const :tag "Off" off) | |
| 164 (color :tag "Colored")) | |
| 165 (lambda (face value &optional frame) | |
| 166 (cond ((eq value 'off) (setq value nil)) | |
| 167 ((null value) (setq value 'unspecified))) | |
| 168 (set-face-attribute face frame :underline value)) | |
| 169 (lambda (face &optional frame) | |
| 170 (let ((underline (face-attribute face :underline frame))) | |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
171 (cond ((eq underline 'unspecified) nil) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
172 ((null underline) 'off))))) |
| 24984 | 173 |
| 174 (:overline | |
| 175 (choice :tag "Overline" | |
| 176 :help-echo "Control text overlining." | |
| 177 (const :tag "*" nil) | |
| 178 (const :tag "On" t) | |
| 179 (const :tag "Off" off) | |
| 180 (color :tag "Colored")) | |
| 181 (lambda (face value &optional frame) | |
| 182 (cond ((eq value 'off) (setq value nil)) | |
| 183 ((null value) (setq value 'unspecified))) | |
| 184 (set-face-attribute face frame :overline value)) | |
| 185 (lambda (face &optional frame) | |
| 186 (let ((overline (face-attribute face :overline frame))) | |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
187 (cond ((eq overline 'unspecified) nil) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
188 ((null overline) 'off))))) |
| 24984 | 189 |
| 190 (:strike-through | |
| 191 (choice :tag "Strike-through" | |
| 192 :help-echo "Control text strike-through." | |
| 193 (const :tag "*" nil) | |
| 194 (const :tag "On" t) | |
| 195 (const :tag "Off" off) | |
| 196 (color :tag "Colored")) | |
| 197 (lambda (face value &optional frame) | |
| 198 (cond ((eq value 'off) (setq value nil)) | |
| 199 ((null value) (setq value 'unspecified))) | |
| 200 (set-face-attribute face frame :strike-through value)) | |
| 201 (lambda (face &optional frame) | |
| 202 (let ((value (face-attribute face :strike-through frame))) | |
| 203 (cond ((eq value 'unspecified) (setq value nil)) | |
| 204 ((null value) (setq value 'off))) | |
| 205 value))) | |
| 206 | |
| 207 (:box | |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
208 ;; Fixme: this can probably be done better. |
| 24984 | 209 (choice :tag "Box around text" |
| 210 :help-echo "Control box around text." | |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
211 (const :tag "*" t) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
212 (const :tag "Off" nil) |
| 24984 | 213 (list :tag "Box" |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
214 :value (:line-width 2 :color "grey75" |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
215 :style released-button) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
216 (const :format "" :value :line-width) |
| 24984 | 217 (integer :tag "Width") |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
218 (const :format "" :value :color) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
219 (choice :tag "Color" (const :tag "*" nil) color) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
220 (const :format "" :value :style) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
221 (choice :tag "Style" |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
222 (const :tag "Raised" released-button) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
223 (const :tag "Sunken" pressed-button) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
224 (const :tag "None" nil)))) |
| 24984 | 225 (lambda (face value &optional frame) |
| 226 (set-face-attribute face frame :box value)) | |
| 227 (lambda (face &optional frame) | |
| 228 (let ((value (face-attribute face :box frame))) | |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
229 (if (consp value) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
230 (list :line-width (or (plist-get value :line-width) 1) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
231 :color (plist-get value :color) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
232 :style (plist-get value :style)) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
233 value)))) |
| 24984 | 234 |
| 235 (:inverse-video | |
| 236 (choice :tag "Inverse-video" | |
| 237 :help-echo "Control whether text should be in inverse-video." | |
| 238 (const :tag "*" nil) | |
| 239 (const :tag "On" t) | |
| 240 (const :tag "Off" off)) | |
| 241 (lambda (face value &optional frame) | |
| 242 (cond ((eq value 'off) (setq value nil)) | |
| 243 ((null value) (setq value 'unspecified))) | |
| 244 (set-face-attribute face frame :inverse-video value)) | |
| 245 (lambda (face &optional frame) | |
| 246 (let ((value (face-attribute face :inverse-video frame))) | |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
247 (cond ((eq value 'unspecified) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
248 nil) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
249 ((null value)'off))))) |
| 24984 | 250 |
| 251 (:foreground | |
| 252 (choice :tag "Foreground" | |
| 253 :help-echo "Set foreground color." | |
| 254 (const :tag "*" nil) | |
| 255 (color :tag "Color")) | |
| 256 (lambda (face value &optional frame) | |
| 257 (set-face-attribute face frame :foreground (or value 'unspecified))) | |
| 258 (lambda (face &optional frame) | |
| 259 (let ((value (face-attribute face :foreground frame))) | |
| 260 (if (eq value 'unspecified) nil value)))) | |
| 261 | |
| 262 (:background | |
| 263 (choice :tag "Background" | |
| 264 :help-echo "Set background color." | |
| 265 (const :tag "*" nil) | |
| 266 (color :tag "Color")) | |
| 267 (lambda (face value &optional frame) | |
| 268 (set-face-attribute face frame :background (or value 'unspecified))) | |
| 269 (lambda (face &optional frame) | |
| 270 (let ((value (face-attribute face :background frame))) | |
| 271 (if (eq value 'unspecified) nil value)))) | |
| 272 | |
| 273 (:stipple | |
| 274 (choice :tag "Stipple" | |
| 275 :help-echo "Name of background bitmap file." | |
| 276 (const :tag "*" nil) | |
| 277 (file :tag "File" :must-match t)) | |
| 278 (lambda (face value &optional frame) | |
| 279 (set-face-attribute face frame :stipple (or value 'unspecified))) | |
| 280 (lambda (face &optional frame) | |
| 281 (let ((value (face-attribute face :stipple frame))) | |
| 282 (if (eq value 'unspecified) nil value))))) | |
| 283 | |
| 284 "Alist of face attributes. | |
| 285 | |
| 286 The elements are of the form (KEY TYPE SET GET), where KEY is the name | |
| 287 of the attribute, TYPE is a widget type for editing the attibute, SET | |
| 288 is a function for setting the attribute value, and GET is a function | |
| 289 for getiing the attribute value. | |
| 17334 | 290 |
| 291 The SET function should take three arguments, the face to modify, the | |
| 292 value of the attribute, and optionally the frame where the face should | |
| 293 be changed. | |
| 294 | |
| 295 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
|
296 optionally the frame where the face should be examined.") |
| 17334 | 297 |
| 24984 | 298 |
| 17334 | 299 (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
|
300 "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
|
301 The list has the form (KEYWORD VALUE KEYWORD VALUE...). |
| 17334 | 302 Each keyword should be listed in `custom-face-attributes'. |
| 303 | |
|
17524
8ba505704d9d
Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
304 If FRAME is nil, use the global defaults for FACE." |
| 24984 | 305 (let ((attrs custom-face-attributes) |
| 306 plist) | |
| 307 (while attrs | |
| 308 (let* ((attribute (car (car attrs))) | |
| 309 (value (face-attribute face attribute frame))) | |
| 310 (setq attrs (cdr attrs)) | |
| 311 (unless (eq value 'unspecified) | |
| 312 (setq plist (cons attribute (cons value plist)))))) | |
| 313 plist)) | |
| 17334 | 314 |
| 315 ;;; Initializing. | |
| 316 | |
| 317 ;;;###autoload | |
| 318 (defun custom-set-faces (&rest args) | |
| 319 "Initialize faces according to user preferences. | |
| 320 The arguments should be a list where each entry has the form: | |
| 321 | |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
322 (FACE SPEC [NOW [COMMENT]]) |
| 17334 | 323 |
|
17524
8ba505704d9d
Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
324 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
|
325 If NOW is present and non-nil, FACE is created now, according to SPEC. |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
326 COMMENT is a string comment about FACE. |
| 17334 | 327 |
| 328 See `defface' for the format of SPEC." | |
| 329 (while args | |
| 330 (let ((entry (car args))) | |
| 331 (if (listp entry) | |
| 332 (let ((face (nth 0 entry)) | |
| 333 (spec (nth 1 entry)) | |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
334 (now (nth 2 entry)) |
|
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
335 (comment (nth 3 entry))) |
| 17334 | 336 (put face 'saved-face spec) |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
337 (put face 'saved-face-comment comment) |
| 17334 | 338 (when now |
| 339 (put face 'force-face t)) | |
|
17524
8ba505704d9d
Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
340 (when (or now (facep face)) |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
341 (put face 'face-comment comment) |
|
17524
8ba505704d9d
Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
342 (make-empty-face face) |
|
8ba505704d9d
Major simplification; most of file contents deleted.
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
343 (face-spec-set face spec)) |
| 17334 | 344 (setq args (cdr args))) |
| 345 ;; Old format, a plist of FACE SPEC pairs. | |
| 346 (let ((face (nth 0 args)) | |
| 347 (spec (nth 1 args))) | |
| 348 (put face 'saved-face spec)) | |
| 349 (setq args (cdr (cdr args))))))) | |
| 350 | |
| 351 ;;; The End. | |
| 352 | |
| 353 (provide 'cus-face) | |
| 354 | |
|
25684
e3ed0e86532c
(custom-face-attributes): Simplify :underline, :overline,
Dave Love <fx@gnu.org>
parents:
24984
diff
changeset
|
355 ;;; cus-face.el ends here |
