]> git.eshelyaron.com Git - emacs.git/commitdiff
Document better how to reset attributes of faces for new frames
authorEli Zaretskii <eliz@gnu.org>
Sat, 26 Feb 2022 07:41:05 +0000 (09:41 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 26 Feb 2022 07:41:05 +0000 (09:41 +0200)
* doc/lispref/display.texi (Attribute Functions):
* lisp/faces.el (set-face-attribute): Explain how to reset an
attribute's value for future frames.  (Bug#54156)

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

index 0ea421c774bccb31df645c77e6ab6b3733715ced..8a138588d319faa101d13a9748068c0698eba3a0 100644 (file)
@@ -2915,12 +2915,21 @@ names (such as @code{:family} or @code{:underline}) and values.  Thus,
 sets the attribute @code{:weight} to @code{bold} and the attribute
 @code{:slant} to @code{italic}.
 
-
 If @var{frame} is @code{t}, this function sets the default attributes
 for newly created frames; they will effectively override the attribute
 values specified by @code{defface}.  If @var{frame} is @code{nil},
 this function sets the attributes for all existing frames, as well as
-for newly created frames.
+for newly created frames.  However, if you want to @emph{reset} the
+value of an attribute to @code{unspecified} in a way that also affects
+newly created frames, you @emph{must} explicitly call this function
+with @var{frame} set to @code{t} and the value of the attribute set to
+@code{unspecified} (@emph{not} @code{nil}!@:), in addition to the call
+with @var{frame} set to @code{nil}.  This is because the default
+attributes for newly created frames are merged with the face's spec in
+@code{defface} when a new frame is created, and so having
+@code{unspecified} in the default attributes for new frames will be
+unable to override @code{defface}; the special call to this function
+as described above will arrange for @code{defface} to be overridden.
 @end defun
 
   The following commands and functions mostly provide compatibility
index 50a82d454be871bc44a77e7aa9d6189d134935b9..1d21a216224141af085994ba8b817435c6896fb1 100644 (file)
@@ -663,7 +663,12 @@ face spec.  It is mostly intended for internal use only.
 
 If FRAME is nil, set the attributes for all existing frames, as
 well as the default for new frames.  If FRAME is t, change the
-default for new frames only.
+default for new frames only.  As an exception, to reset the value
+of some attribute to `unspecified' in a way that overrides the
+non-`unspecified' value defined by the face's spec in `defface',
+for new frames, you must explicitly call this function with FRAME
+set to t and the attribute's value set to `unspecified'; just
+using FRAME of nil will not affect new frames in this case.
 
 ARGS must come in pairs ATTRIBUTE VALUE.  ATTRIBUTE must be a
 valid face attribute name.  All attributes can be set to