aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love1999-09-13 13:09:30 +0000
committerDave Love1999-09-13 13:09:30 +0000
commit1743c17a3605c45353015eb0fae5ca9c69ebfe66 (patch)
treedb2c90fdac6343568882df3c3e71e6b7e83e87db
parent70647e337e404182d45ed4d29e179773fcadf9be (diff)
downloademacs-1743c17a3605c45353015eb0fae5ca9c69ebfe66.tar.gz
emacs-1743c17a3605c45353015eb0fae5ca9c69ebfe66.zip
(custom-face-attributes): Simplify :underline, :overline,
:inverse-video cases. Fix up :box case (probably needs more work). Change from Didier Verna: (custom-set-faces): The arguments can now have a custom comment as fourth argument.
-rw-r--r--lisp/cus-face.el75
1 files changed, 34 insertions, 41 deletions
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index 4137161de0c..2b32ce3f522 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -1,11 +1,11 @@
1;;; cus-face.el -- customization support for faces. 1;;; cus-face.el -- customization support for faces.
2;; 2;;
3;; Copyright (C) 1996, 1997 Free Software Foundation, Inc. 3;; Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
4;; 4;;
5;; Author: Per Abrahamsen <abraham@dina.kvl.dk> 5;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6;; Keywords: help, faces 6;; Keywords: help, faces
7;; Version: Emacs 7;; Version: Emacs
8;; X-URL: http://www.dina.kvl.dk/~abraham/custom/ 8;; X-URL: http://www.dina.kvl.dk/~abraham/custom/ (probably obsolete)
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -168,9 +168,8 @@
168 (set-face-attribute face frame :underline value)) 168 (set-face-attribute face frame :underline value))
169 (lambda (face &optional frame) 169 (lambda (face &optional frame)
170 (let ((underline (face-attribute face :underline frame))) 170 (let ((underline (face-attribute face :underline frame)))
171 (cond ((eq underline 'unspecified) (setq underline nil)) 171 (cond ((eq underline 'unspecified) nil)
172 ((null underline) (setq underline 'off))) 172 ((null underline) 'off)))))
173 underline)))
174 173
175 (:overline 174 (:overline
176 (choice :tag "Overline" 175 (choice :tag "Overline"
@@ -185,9 +184,8 @@
185 (set-face-attribute face frame :overline value)) 184 (set-face-attribute face frame :overline value))
186 (lambda (face &optional frame) 185 (lambda (face &optional frame)
187 (let ((overline (face-attribute face :overline frame))) 186 (let ((overline (face-attribute face :overline frame)))
188 (cond ((eq overline 'unspecified) (setq overline nil)) 187 (cond ((eq overline 'unspecified) nil)
189 ((null overline) (setq overline 'off))) 188 ((null overline) 'off)))))
190 overline)))
191 189
192 (:strike-through 190 (:strike-through
193 (choice :tag "Strike-through" 191 (choice :tag "Strike-through"
@@ -207,41 +205,32 @@
207 value))) 205 value)))
208 206
209 (:box 207 (:box
208 ;; Fixme: this can probably be done better.
210 (choice :tag "Box around text" 209 (choice :tag "Box around text"
211 :help-echo "Control box around text." 210 :help-echo "Control box around text."
212 (const :tag "*" nil) 211 (const :tag "*" t)
213 (const :tag "Off" off) 212 (const :tag "Off" nil)
214 (list :tag "Box" 213 (list :tag "Box"
215 :value (1 "black" nil) 214 :value (:line-width 2 :color "grey75"
215 :style released-button)
216 (const :format "" :value :line-width)
216 (integer :tag "Width") 217 (integer :tag "Width")
217 (color :tag "Color") 218 (const :format "" :value :color)
218 (choice :tag "Shadows" 219 (choice :tag "Color" (const :tag "*" nil) color)
219 (const :tag "None" nil) 220 (const :format "" :value :style)
220 (const :tag "Raised" raised) 221 (choice :tag "Style"
221 (const :tag "Sunken" sunken)))) 222 (const :tag "Raised" released-button)
223 (const :tag "Sunken" pressed-button)
224 (const :tag "None" nil))))
222 (lambda (face value &optional frame) 225 (lambda (face value &optional frame)
223 (cond ((consp value)
224 (let ((width (nth 0 value))
225 (color (nth 1 value))
226 (shadow (nth 2 value)))
227 (setq value (list :width width :color color :shadow shadow))))
228 ((eq value 'off)
229 (setq value nil))
230 ((null value)
231 (setq value 'unspecified)))
232 (set-face-attribute face frame :box value)) 226 (set-face-attribute face frame :box value))
233 (lambda (face &optional frame) 227 (lambda (face &optional frame)
234 (let ((value (face-attribute face :box frame))) 228 (let ((value (face-attribute face :box frame)))
235 (cond ((consp value) 229 (if (consp value)
236 (let ((width (plist-get value :width)) 230 (list :line-width (or (plist-get value :line-width) 1)
237 (color (plist-get value :color)) 231 :color (plist-get value :color)
238 (shadow (plist-get value :shadow))) 232 :style (plist-get value :style))
239 (setq value (list width color shadow)))) 233 value))))
240 ((eq value 'unspecified)
241 (setq value nil))
242 ((null value)
243 (setq value 'off)))
244 value)))
245 234
246 (:inverse-video 235 (:inverse-video
247 (choice :tag "Inverse-video" 236 (choice :tag "Inverse-video"
@@ -255,9 +244,9 @@
255 (set-face-attribute face frame :inverse-video value)) 244 (set-face-attribute face frame :inverse-video value))
256 (lambda (face &optional frame) 245 (lambda (face &optional frame)
257 (let ((value (face-attribute face :inverse-video frame))) 246 (let ((value (face-attribute face :inverse-video frame)))
258 (cond ((eq value 'unspecified) (setq value nil)) 247 (cond ((eq value 'unspecified)
259 ((null value) (setq value 'off))) 248 nil)
260 value))) 249 ((null value)'off)))))
261 250
262 (:foreground 251 (:foreground
263 (choice :tag "Foreground" 252 (choice :tag "Foreground"
@@ -330,10 +319,11 @@ If FRAME is nil, use the global defaults for FACE."
330 "Initialize faces according to user preferences. 319 "Initialize faces according to user preferences.
331The arguments should be a list where each entry has the form: 320The arguments should be a list where each entry has the form:
332 321
333 (FACE SPEC [NOW]) 322 (FACE SPEC [NOW [COMMENT]])
334 323
335SPEC is stored as the saved value for FACE. 324SPEC is stored as the saved value for FACE.
336If NOW is present and non-nil, FACE is created now, according to SPEC. 325If NOW is present and non-nil, FACE is created now, according to SPEC.
326COMMENT is a string comment about FACE.
337 327
338See `defface' for the format of SPEC." 328See `defface' for the format of SPEC."
339 (while args 329 (while args
@@ -341,11 +331,14 @@ See `defface' for the format of SPEC."
341 (if (listp entry) 331 (if (listp entry)
342 (let ((face (nth 0 entry)) 332 (let ((face (nth 0 entry))
343 (spec (nth 1 entry)) 333 (spec (nth 1 entry))
344 (now (nth 2 entry))) 334 (now (nth 2 entry))
335 (comment (nth 3 entry)))
345 (put face 'saved-face spec) 336 (put face 'saved-face spec)
337 (put face 'saved-face-comment comment)
346 (when now 338 (when now
347 (put face 'force-face t)) 339 (put face 'force-face t))
348 (when (or now (facep face)) 340 (when (or now (facep face))
341 (put face 'face-comment comment)
349 (make-empty-face face) 342 (make-empty-face face)
350 (face-spec-set face spec)) 343 (face-spec-set face spec))
351 (setq args (cdr args))) 344 (setq args (cdr args)))
@@ -359,4 +352,4 @@ See `defface' for the format of SPEC."
359 352
360(provide 'cus-face) 353(provide 'cus-face)
361 354
362;; cus-face.el ends here 355;;; cus-face.el ends here