]> git.eshelyaron.com Git - emacs.git/commitdiff
(face-all-attributes): New function.
authorRichard M. Stallman <rms@gnu.org>
Sun, 30 Dec 2007 16:26:54 +0000 (16:26 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 30 Dec 2007 16:26:54 +0000 (16:26 +0000)
(face-differs-from-default-p): Compute list of attr names
from face-attribute-name-alist.

etc/NEWS
lisp/ChangeLog
lisp/faces.el

index c71fb2ae349809d0eb9e97871d9aceeeb18c50d0..90cc3efaf8d4e554e1914625b057d7604757b1f9 100644 (file)
--- 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.
index 5126ebe2d1029feca829f96bc150cf583fca48bd..35163804e3a9233293bcbd4e530902296ff36c5d 100644 (file)
@@ -6,6 +6,11 @@
 
 2007-12-30  Richard Stallman  <rms@gnu.org>
 
+       * 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.
index 74d1a4e4f258d772f67a46cd0112116aba0f0583..5f8f6d58522a54a050948f21691f4ece4041b799 100644 (file)
@@ -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.