Subject: Re: bug#45264: 26.3; `face-remap-set-base' seems to be bugged

From: Eli Zaretskii <[email-masked]>
Date: Sat, 19 Dec 2020 12:20:04 +0200

> Date: Tue, 15 Dec 2020 16:31:31 -0800 (PST)
> From: Drew Adams <[email-masked]>
> 
> (defface foo '((t (:background "red"))) "...")
> 
> (face-remap-set-base 'font-lock-keyword-face 'foo)
> 
> The &rest arg SPECS is `(foo)', which is, as required, a list of
> (one) face.
> 
> But the code actually expects `foo' itself to be a list.  It raises
> an error, because it sets SPECS to just `foo' and then tries to
> take the car of it.
> 
> (while (and (consp specs)
>             (not (null (car specs)))
>             (null (cdr specs)))
>   (setq specs (car specs))) ; <=========
> 
> (if (or (null specs)
>     (and (eq (car specs) face) ; <=========
>          (null (cdr specs))))
> 
> Is there a doc bug (both manual and doc string)?  Or is there a code
> bug?  Or am I missing something?

I don't see anything wrong with the documentation yet.  One needs to
know and understand what is a "face spec", and then everything falls
into its place.  The &rest part is also a big hint.

Can I turn the table and ask you why you thought the argument could be
a list of one or more faces?  The doc string says "should FORM a list
of faces", it doesn't say it should BE a list of faces.  And since
when does &rest specify a single argument that is a list?