From a8ddec0aea0c0290ecfe36a97dc2587633c6731b Mon Sep 17 00:00:00 2001 From: shipmints Date: Sun, 20 Apr 2025 13:09:35 -0400 Subject: [PATCH] Add optional inherit argument to 'face-all-attributes' (bug#77945) * lisp/faces.el (face-all-attributes): Add 'inherit' argument and pass to 'face-attribute'. (cherry picked from commit 13fa74b73c36de2439f7cae13f25647fb46161e9) --- doc/lispref/display.texi | 15 +++++++++------ lisp/faces.el | 13 +++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 778716c0dc2..b5fd0b63d18 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -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 diff --git a/lisp/faces.el b/lisp/faces.el index f092c927617..f3bdd89eb19 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -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) -- 2.39.5