From: Eli Zaretskii <eliz@gnu.org>
To: Brennan Vincent <brennan@umanwizard.com>
Cc: 61521-done@debbugs.gnu.org
Subject: bug#61521: "default" is now the first item returned from (font-faces), breaking various code.
Date: Fri, 17 Feb 2023 10:29:39 +0200 [thread overview]
Message-ID: <83pma81yq4.fsf@gnu.org> (raw)
In-Reply-To: <05d313ea-7355-189f-62b0-1ba439ff0acf@umanwizard.com> (message from Brennan Vincent on Wed, 15 Feb 2023 11:19:54 -0500)
> Date: Wed, 15 Feb 2023 11:19:54 -0500
> Cc: 61521@debbugs.gnu.org
> From: Brennan Vincent <brennan@umanwizard.com>
>
> > Good question. AFAICT, the sorting was added when we switched from
> > storing faces in alists to storing them in hash tables. It probably
> > sorted faces to be more compatible with what face-list returned before
> > the switch to hash table. So I suspect the order we have now is
> > simply a bug, and we do need to change the order of sorting to get
> > back the original order.
>
> I tend to agree. Sorry for not explaining this reasoning more fully in my
> original message.
>
> Here's what I suspect happened (not 100% sure, it's just a theory):
>
> (1) Initially set of faces was stored as a list, so it was naturally maintained
> in the inverse order that things were added to it (thus default would be at the
> end).
>
> (2) Now faces are stored in a hash table whose key is the face and whose value
> contains various pieces of data, including the face ID.
>
> (3) This face ID is allocated in increasing order (see e.g. this code in xfaces.c:
> Lisp_Object face_id = make_fixnum (next_lface_id);
> lface_id_to_name[next_lface_id] = face;
> Fput (face, Qface, face_id);
> ++next_lface_id;
>
> (4) Thus, `face-list` and `frame-face-alist` sorted the faces by face ID in
> order to maintain the old ordering behavior. However, the author accidentally
> inverted the comparison when doing so.
>
>
> > Gregory, any counter-arguments?
No further comments, so I've now installed the proposed changes on the
emacs-29 branch, and I'm boldly closing this bug as done.
prev parent reply other threads:[~2023-02-17 8:29 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
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 [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83pma81yq4.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=61521-done@debbugs.gnu.org \
--cc=brennan@umanwizard.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).