Subject: bug#61521: "default" is now the first item returned from (font-faces), breaking various code.

From: Kai Ma <[email-masked]>
Date: Sat, 18 Feb 2023 14:54:12 +0800

> On Feb 18, 2023, at 14:49, Eli Zaretskii <[email-masked]> wrote:
> 
>> From: Kai Ma <[email-masked] <mailto:[email-masked]>>
>> Cc: Eli Zaretskii <[email-masked] <mailto:[email-masked]>>,  [email-masked] <mailto:[email-masked]>,
>>  [email-masked] <mailto:[email-masked]>
>> Date: Sat, 18 Feb 2023 06:17:25 +0800
>> 
>> My config becomes broken after pulling this change: the child frame of
>> vertico-posframe does not appear under certain themes, and signals
>> errors like:
>> 
>>  Error in post-command-hook (vertico--exhibit): (error "Invalid face" consult-separator)
>>  Error in post-command-hook (vertico--exhibit): (error "Invalid face" hl-todo)
>> 
>> I'm not sure if this is a downstream issue, but this problem can be
>> solved by either reverting this commit or removing the nreverse in
>> x-create-frame-with-faces:
>> 
>> diff --git a/lisp/faces.el b/lisp/faces.el
>> index 4933b495a6c..e91107e98cc 100644
>> --- a/lisp/faces.el
>> +++ b/lisp/faces.el
>> @@ -2226,7 +2226,7 @@ x-create-frame-with-faces
>>     (unwind-protect
>> 	(progn
>> 	  (x-setup-function-keys frame)
>> -	  (dolist (face (nreverse (face-list)))
>> +	  (dolist (face (face-list)))
>> 	    (face-spec-recalc face frame))
>> 	  (x-handle-reverse-video frame parameters)
>> 	  (frame-set-background-mode frame t)
>> 
>> This piece of code (w/ nreverse) was written as part of the hash table
>> rewrite, and at that time (face-list) did not sort its results.  I don't
>> know why nreverse is significant here though.
> 
> Which change are you talking about?  Please clarify.

The fix of this bug, commit a555abc56d5 on branch emacs-29.

> The original problem was solved recently on the emacs-29 branch by
> reversing the order in which face-list sorts the faces, to make it
> similar to what we had before the hash table rewrite.  So there should
> be no reason to change any other code anywhere else.
> 
> Thanks.