all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kai Ma <justksqsf@gmail.com>
To: Gregory Heytings <gregory@heytings.org>
Cc: brennan@umanwizard.com, Eli Zaretskii <eliz@gnu.org>,
	61521@debbugs.gnu.org
Subject: bug#61521: "default" is now the first item returned from (font-faces), breaking various code.
Date: Sat, 18 Feb 2023 06:17:25 +0800	[thread overview]
Message-ID: <m21qmoq6mi.fsf@gmail.com> (raw)
In-Reply-To: <9e9ed8043fd6413e6183@heytings.org> (Gregory Heytings's message of "Wed, 15 Feb 2023 14:11:55 +0000")

Gregory Heytings <gregory@heytings.org> writes:

>>> Thanks.  It seems the change you describe is not a recent one: the
>>> first element of the list returned by 'face-list' is 'default' in
>>> Emacs 27, 28, 29 and 30.  (This is caused by e3b8ddd500, since
>>> which frame faces are stored in a hash table instead of an alist.)
>>
>> Right.  So I wonder whether we should remove the nreverse call in
>> face-set-after-frame-default.  WDYT?
>>
>
> There are three occurrences of '(nreverse (face-list))': one in
> facemenu-complete-face-list, which seems to date from the 1990s, one
> in x-create-frame-with-faces, which was added by e3b8ddd500 "to handle
> subtle semantic change to how frame faces propagate, which otherwise
> breaks frame creation with reverse video enabled (bug#41200)", and the
> third one in 'face-set-after-frame-default'.
>
> The comment there is definitely outdated and should be removed, but
> given that '(nreverse (face-list))' is placed in a dolist whose body
> starts with '(face-spec-recalc face frame)', like in
> x-create-frame-with-faces, I'm not sure the nreverse can be removed
> without introducing a subtle bug. It is probably safer to leave the
> code unchanged.

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.





  reply	other threads:[~2023-02-17 22:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15  0:31 bug#61521: "default" is now the first item returned from (font-faces), breaking various code Brennan Vincent
2023-02-15  0:52 ` Brennan Vincent
2023-02-15  1:00 ` Gregory Heytings
2023-02-15  1:06   ` Brennan Vincent
2023-02-15  9:00     ` Gregory Heytings
2023-02-15 13:43       ` Eli Zaretskii
2023-02-15 14:11         ` Gregory Heytings
2023-02-17 22:17           ` Kai Ma [this message]
2023-02-18  6:49             ` Eli Zaretskii
2023-02-18  6:54               ` Kai Ma
2023-02-18  7:40                 ` Eli Zaretskii
2023-02-15 12:58 ` Eli Zaretskii
2023-02-15 14:01   ` Brennan Vincent
2023-02-15 14:19     ` Gregory Heytings
2023-02-15 14:24     ` Eli Zaretskii
2023-02-15 16:19       ` Brennan Vincent
2023-02-17  8:29         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m21qmoq6mi.fsf@gmail.com \
    --to=justksqsf@gmail.com \
    --cc=61521@debbugs.gnu.org \
    --cc=brennan@umanwizard.com \
    --cc=eliz@gnu.org \
    --cc=gregory@heytings.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.