diff options
| author | Eli Zaretskii | 2017-06-10 11:39:59 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-06-10 11:39:59 +0300 |
| commit | 1a3feb8eade24eaff6dcd9edc032cfcd35e41dd7 (patch) | |
| tree | 67bc4b410edaa9c0e778f4b328bf5241df0f096b /lisp | |
| parent | 30c0f81f9faca5df012a93b6b0dc9cab5a7de65d (diff) | |
| download | emacs-1a3feb8eade24eaff6dcd9edc032cfcd35e41dd7.tar.gz emacs-1a3feb8eade24eaff6dcd9edc032cfcd35e41dd7.zip | |
Improve documentation of 'face-spec-set-2'
* lisp/faces.el (face-spec-recalc, face-spec-set-2): Rename 'spec'
to 'face-attrs'.
(face-spec-choose, face-spec-set-2): Doc fix. (Bug#27238)
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/faces.el | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index a6ffd1ecd33..1f9b3974c72 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -1594,6 +1594,7 @@ If FRAME is nil, the current FRAME is used." | |||
| 1594 | (defun face-spec-choose (spec &optional frame no-match-retval) | 1594 | (defun face-spec-choose (spec &optional frame no-match-retval) |
| 1595 | "Return the proper attributes for FRAME, out of SPEC. | 1595 | "Return the proper attributes for FRAME, out of SPEC. |
| 1596 | 1596 | ||
| 1597 | Value is a plist of face attributes in the form of attribute-value pairs. | ||
| 1597 | If no match is found or SPEC is nil, return nil, unless NO-MATCH-RETVAL | 1598 | If no match is found or SPEC is nil, return nil, unless NO-MATCH-RETVAL |
| 1598 | is given, in which case return its value instead." | 1599 | is given, in which case return its value instead." |
| 1599 | (unless frame | 1600 | (unless frame |
| @@ -1734,32 +1735,34 @@ The following sources are applied in this order: | |||
| 1734 | ;; `theme-face' records. | 1735 | ;; `theme-face' records. |
| 1735 | (let ((theme-faces (get face 'theme-face)) | 1736 | (let ((theme-faces (get face 'theme-face)) |
| 1736 | (no-match-found 0) | 1737 | (no-match-found 0) |
| 1737 | spec theme-face-applied) | 1738 | face-attrs theme-face-applied) |
| 1738 | (if theme-faces | 1739 | (if theme-faces |
| 1739 | (dolist (elt (reverse theme-faces)) | 1740 | (dolist (elt (reverse theme-faces)) |
| 1740 | (setq spec (face-spec-choose (cadr elt) frame no-match-found)) | 1741 | (setq face-attrs (face-spec-choose (cadr elt) frame no-match-found)) |
| 1741 | (unless (eq spec no-match-found) | 1742 | (unless (eq face-attrs no-match-found) |
| 1742 | (face-spec-set-2 face frame spec) | 1743 | (face-spec-set-2 face frame face-attrs) |
| 1743 | (setq theme-face-applied t)))) | 1744 | (setq theme-face-applied t)))) |
| 1744 | ;; If there was a spec applicable to FRAME, that overrides the | 1745 | ;; If there was a spec applicable to FRAME, that overrides the |
| 1745 | ;; defface spec entirely (rather than inheriting from it). If | 1746 | ;; defface spec entirely (rather than inheriting from it). If |
| 1746 | ;; there was no spec applicable to FRAME, apply the defface spec | 1747 | ;; there was no spec applicable to FRAME, apply the defface spec |
| 1747 | ;; as well as any applicable X resources. | 1748 | ;; as well as any applicable X resources. |
| 1748 | (unless theme-face-applied | 1749 | (unless theme-face-applied |
| 1749 | (setq spec (face-spec-choose (face-default-spec face) frame)) | 1750 | (setq face-attrs (face-spec-choose (face-default-spec face) frame)) |
| 1750 | (face-spec-set-2 face frame spec) | 1751 | (face-spec-set-2 face frame face-attrs) |
| 1751 | (make-face-x-resource-internal face frame)) | 1752 | (make-face-x-resource-internal face frame)) |
| 1752 | (setq spec (face-spec-choose (get face 'face-override-spec) frame)) | 1753 | (setq face-attrs (face-spec-choose (get face 'face-override-spec) frame)) |
| 1753 | (face-spec-set-2 face frame spec))) | 1754 | (face-spec-set-2 face frame face-attrs))) |
| 1754 | 1755 | ||
| 1755 | (defun face-spec-set-2 (face frame spec) | 1756 | (defun face-spec-set-2 (face frame face-attrs) |
| 1756 | "Set the face attributes of FACE on FRAME according to SPEC." | 1757 | "Set the face attributes of FACE on FRAME according to FACE-ATTRS. |
| 1758 | FACE-ATTRS is a plist of face attributes in the form of attribute-value | ||
| 1759 | pairs." | ||
| 1757 | (let (attrs) | 1760 | (let (attrs) |
| 1758 | (while spec | 1761 | (while face-attrs |
| 1759 | (when (assq (car spec) face-x-resources) | 1762 | (when (assq (car face-attrs) face-x-resources) |
| 1760 | (push (car spec) attrs) | 1763 | (push (car face-attrs) attrs) |
| 1761 | (push (cadr spec) attrs)) | 1764 | (push (cadr face-attrs) attrs)) |
| 1762 | (setq spec (cddr spec))) | 1765 | (setq face-attrs (cddr face-attrs))) |
| 1763 | (apply 'set-face-attribute face frame (nreverse attrs)))) | 1766 | (apply 'set-face-attribute face frame (nreverse attrs)))) |
| 1764 | 1767 | ||
| 1765 | (defun face-attr-match-p (face attrs &optional frame) | 1768 | (defun face-attr-match-p (face attrs &optional frame) |