aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>2007-12-30 16:26:54 +0000
committerRichard M. Stallman <[email protected]>2007-12-30 16:26:54 +0000
commit833547aacbfbf3269619341d8bec9ec6d2282230 (patch)
treed37f3cfb0772aa86b84cf4b3904b61c1093e3eff
parent80f9d13bfff89c026469d172128a3ea58ce31627 (diff)
(face-all-attributes): New function.
(face-differs-from-default-p): Compute list of attr names from face-attribute-name-alist.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/faces.el14
3 files changed, 19 insertions, 3 deletions
diff --git a/etc/NEWS b/etc/NEWS
index c71fb2ae34..90cc3efaf8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -470,6 +470,9 @@ the specified files).
** The new function `read-color' reads a color name using the minibuffer.
+** The new function `face-all-attributes' returns an alist
+describing all the basic attributes of a given face.
+
** `interprogram-paste-function' can now return one string or a list
of strings. In the latter case, Emacs puts the second and following
strings on the kill ring.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5126ebe2d1..35163804e3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -6,6 +6,11 @@
2007-12-30 Richard Stallman <[email protected]>
+ * faces.el (face-all-attributes): New function.
+
+ * faces.el (face-differs-from-default-p): Compute list of attr names
+ from face-attribute-name-alist.
+
* cus-edit.el (custom-face-set): Call `face-spec-set' with FOR-DEFFACE.
(custom-face-save): Likewise.
(custom-face-reset-saved, custom-face-reset-standard): Likewise.
diff --git a/lisp/faces.el b/lisp/faces.el
index 74d1a4e4f2..5f8f6d5852 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -249,9 +249,7 @@ If the optional argument FRAME is given, report on face FACE in that frame.
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 @@ FRAME nil or not specified means do it for all frames."
(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.