aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2007-12-30 16:26:54 +0000
committerRichard M. Stallman2007-12-30 16:26:54 +0000
commit833547aacbfbf3269619341d8bec9ec6d2282230 (patch)
treed37f3cfb0772aa86b84cf4b3904b61c1093e3eff
parent80f9d13bfff89c026469d172128a3ea58ce31627 (diff)
downloademacs-833547aacbfbf3269619341d8bec9ec6d2282230.tar.gz
emacs-833547aacbfbf3269619341d8bec9ec6d2282230.zip
(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 c71fb2ae349..90cc3efaf8d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -470,6 +470,9 @@ the specified files).
470 470
471** The new function `read-color' reads a color name using the minibuffer. 471** The new function `read-color' reads a color name using the minibuffer.
472 472
473** The new function `face-all-attributes' returns an alist
474describing all the basic attributes of a given face.
475
473** `interprogram-paste-function' can now return one string or a list 476** `interprogram-paste-function' can now return one string or a list
474of strings. In the latter case, Emacs puts the second and following 477of strings. In the latter case, Emacs puts the second and following
475strings on the kill ring. 478strings on the kill ring.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5126ebe2d10..35163804e3a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -6,6 +6,11 @@
6 6
72007-12-30 Richard Stallman <rms@gnu.org> 72007-12-30 Richard Stallman <rms@gnu.org>
8 8
9 * faces.el (face-all-attributes): New function.
10
11 * faces.el (face-differs-from-default-p): Compute list of attr names
12 from face-attribute-name-alist.
13
9 * cus-edit.el (custom-face-set): Call `face-spec-set' with FOR-DEFFACE. 14 * cus-edit.el (custom-face-set): Call `face-spec-set' with FOR-DEFFACE.
10 (custom-face-save): Likewise. 15 (custom-face-save): Likewise.
11 (custom-face-reset-saved, custom-face-reset-standard): Likewise. 16 (custom-face-reset-saved, custom-face-reset-standard): Likewise.
diff --git a/lisp/faces.el b/lisp/faces.el
index 74d1a4e4f25..5f8f6d58522 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.
249If FRAME is t, report on the defaults for face FACE (for new frames). 249If FRAME is t, report on the defaults for face FACE (for new frames).
250If FRAME is omitted or nil, use the selected frame." 250If FRAME is omitted or nil, use the selected frame."
251 (let ((attrs 251 (let ((attrs
252 '(:family :width :height :weight :slant :foreground 252 (delq :inherit (mapcar 'car face-attribute-name-alist)))
253 :background :underline :overline :strike-through
254 :box :inverse-video))
255 (differs nil)) 253 (differs nil))
256 (while (and attrs (not differs)) 254 (while (and attrs (not differs))
257 (let* ((attr (pop attrs)) 255 (let* ((attr (pop attrs))
@@ -353,6 +351,16 @@ FRAME nil or not specified means do it for all frames."
353 (symbol-name (check-face face))) 351 (symbol-name (check-face face)))
354 352
355 353
354(defun face-all-attributes (face &optional frame)
355 "Return an alist stating the attributes of FACE.
356Each element of the result has the form (ATTR-NAME . ATTR-VALUE).
357Normally the value describes the default attributes,
358but if you specify FRAME, the value describes the attributes
359of FACE on FRAME."
360 (mapcar (lambda (pair) (let ((attr (car pair)))
361 (cons attr (face-attribute face attr frame))))
362 face-attribute-name-alist))
363
356(defun face-attribute (face attribute &optional frame inherit) 364(defun face-attribute (face attribute &optional frame inherit)
357 "Return the value of FACE's ATTRIBUTE on FRAME. 365 "Return the value of FACE's ATTRIBUTE on FRAME.
358If the optional argument FRAME is given, report on face FACE in that frame. 366If the optional argument FRAME is given, report on face FACE in that frame.