changeset 87494:26eb0118cbc6

(face-all-attributes): New function. (face-differs-from-default-p): Compute list of attr names from face-attribute-name-alist.
author Richard M. Stallman <rms@gnu.org>
date Sun, 30 Dec 2007 16:24:52 +0000
parents 42bd83957313
children 0f493fdf9de7
files lisp/faces.el
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/faces.el	Sun Dec 30 15:55:29 2007 +0000
+++ b/lisp/faces.el	Sun Dec 30 16:24:52 2007 +0000
@@ -249,9 +249,7 @@
 If FRAME is t, report on the defaults for face FACE (for new frames).
 If FRAME is omitted or nil, use the selected frame."
   (let ((attrs
-	 '(:family :width :height :weight :slant :foreground
-	   :background :underline :overline :strike-through
-	   :box :inverse-video))
+	 (delq :inherit (mapcar 'car face-attribute-name-alist)))
 	(differs nil))
     (while (and attrs (not differs))
       (let* ((attr (pop attrs))
@@ -353,6 +351,16 @@
   (symbol-name (check-face face)))
 
 
+(defun face-all-attributes (face &optional frame)
+  "Return an alist stating the attributes of FACE.
+Each element of the result has the form (ATTR-NAME . ATTR-VALUE).
+Normally the value describes the default attributes,
+but if you specify FRAME, the value describes the attributes
+of FACE on FRAME."
+  (mapcar (lambda (pair) (let ((attr (car pair)))
+  	  	  	   (cons attr (face-attribute face attr frame))))
+  	  face-attribute-name-alist))
+
 (defun face-attribute (face attribute &optional frame inherit)
   "Return the value of FACE's ATTRIBUTE on FRAME.
 If the optional argument FRAME is given, report on face FACE in that frame.