diff options
| author | Richard M. Stallman | 2007-12-30 16:26:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2007-12-30 16:26:54 +0000 |
| commit | 833547aacbfbf3269619341d8bec9ec6d2282230 (patch) | |
| tree | d37f3cfb0772aa86b84cf4b3904b61c1093e3eff | |
| parent | 80f9d13bfff89c026469d172128a3ea58ce31627 (diff) | |
| download | emacs-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/NEWS | 3 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/faces.el | 14 |
3 files changed, 19 insertions, 3 deletions
| @@ -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 | ||
| 474 | describing 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 |
| 474 | of strings. In the latter case, Emacs puts the second and following | 477 | of strings. In the latter case, Emacs puts the second and following |
| 475 | strings on the kill ring. | 478 | strings 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 | ||
| 7 | 2007-12-30 Richard Stallman <rms@gnu.org> | 7 | 2007-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. | |||
| 249 | If FRAME is t, report on the defaults for face FACE (for new frames). | 249 | If FRAME is t, report on the defaults for face FACE (for new frames). |
| 250 | If FRAME is omitted or nil, use the selected frame." | 250 | If 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. | ||
| 356 | Each element of the result has the form (ATTR-NAME . ATTR-VALUE). | ||
| 357 | Normally the value describes the default attributes, | ||
| 358 | but if you specify FRAME, the value describes the attributes | ||
| 359 | of 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. |
| 358 | If the optional argument FRAME is given, report on face FACE in that frame. | 366 | If the optional argument FRAME is given, report on face FACE in that frame. |