]> git.eshelyaron.com Git - emacs.git/commitdiff
Add optional inherit argument to 'face-all-attributes' (bug#77945)
authorshipmints <shipmints@gmail.com>
Sun, 20 Apr 2025 17:09:35 +0000 (13:09 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sat, 7 Jun 2025 20:02:13 +0000 (22:02 +0200)
* lisp/faces.el (face-all-attributes): Add 'inherit' argument
and pass to 'face-attribute'.

(cherry picked from commit 13fa74b73c36de2439f7cae13f25647fb46161e9)

doc/lispref/display.texi
lisp/faces.el

index 778716c0dc2b6748337d6bda95bc4dbb31898193..b5fd0b63d18dd3d4d19238734650b4211476d62c 100644 (file)
@@ -3182,18 +3182,21 @@ For example:
 @end example
 @end defun
 
-@defun face-all-attributes face &optional frame
+@defun face-all-attributes face &optional frame inherit
 This function returns an alist of attributes of @var{face}.  The
 elements of the result are name-value pairs of the form
 @w{@code{(@var{attr-name} . @var{attr-value})}}.  Optional argument
 @var{frame} specifies the frame whose definition of @var{face} to
 return; if omitted or @code{nil}, the returned value describes the
 default attributes of @var{face} for newly created frames, i.e.@: the
-values these attributes have before applying the face spec in the
-face's @code{defface} definition or the spec set by
-@code{face-spec-set}.  These default values of the attributes are
-normally @code{unspecified}, unless you have specified some other
-value using @code{set-face-attribute}; see below.
+values these attributes have before applying the face spec in the face's
+@code{defface} definition or the spec set by @code{face-spec-set}.
+These default values of the attributes are normally @code{unspecified},
+unless you have specified some other value using
+@code{set-face-attribute}; see below.  The optional argument
+@var{inherit} has the same meaning as the same argument to
+@code{face-attribute}, which see.  This is useful when you want the face
+attributes to be absolute and not @code{unspecified}.
 @end defun
 
 @defun merge-face-attribute attribute value1 value2
index f092c92761726fb853a8d51920cb51a16ae19c82..f3bdd89eb191865ed079209af642aa952aeb7646 100644 (file)
@@ -442,15 +442,16 @@ If `inhibit-x-resources' is non-nil, this function does nothing."
   (symbol-name (check-face face)))
 
 
-(defun face-all-attributes (face &optional frame)
+(defun face-all-attributes (face &optional frame inherit)
   "Return an alist stating the attributes of FACE.
-Each element of the result has the form (ATTR-NAME . ATTR-VALUE).
-If FRAME is omitted or nil the value describes the default attributes,
-but if you specify FRAME, the value describes the attributes
-of FACE on FRAME."
+Each element of the result has the form (ATTR-NAME . ATTR-VALUE).  If
+FRAME is omitted or nil the value describes the default attributes, but
+if you specify FRAME, the value describes the attributes of FACE on
+FRAME.  INHERIT has the same meaning as the same argument to
+`face-attribute', which see."
   (mapcar (lambda (pair)
            (let ((attr (car pair)))
-             (cons attr (face-attribute face attr (or frame t)))))
+             (cons attr (face-attribute face attr (or frame t) inherit))))
          face-attribute-name-alist))
 
 (defun face-attribute (face attribute &optional frame inherit)