From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83pma81yq4.fsf@gnu.org> References: <831qmrcch3.fsf@gnu.org> <2485DA7C-3614-4182-BC29-7EFCF5C86A45@umanwizard.com> <83cz6batw1.fsf@gnu.org> <05d313ea-7355-189f-62b0-1ba439ff0acf@umanwizard.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7218"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61521-done@debbugs.gnu.org To: Brennan Vincent Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 17 09:30:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSw8K-0001ea-3z for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 17 Feb 2023 09:30:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSw85-0001RD-Kr; Fri, 17 Feb 2023 03:30:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSw84-0001QQ-0j for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2023 03:30:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSw83-0006On-Ne for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2023 03:30:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pSw83-0006qu-3j for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2023 03:30:03 -0500 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Feb 2023 08:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 61521 X-GNU-PR-Package: emacs Mail-Followup-To: 61521@debbugs.gnu.org, eliz@gnu.org, brennan@umanwizard.com Original-Received: via spool by 61521-done@debbugs.gnu.org id=D61521.167662258726284 (code D ref 61521); Fri, 17 Feb 2023 08:30:02 +0000 Original-Received: (at 61521-done) by debbugs.gnu.org; 17 Feb 2023 08:29:47 +0000 Original-Received: from localhost ([127.0.0.1]:38411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSw7m-0006ps-SQ for submit@debbugs.gnu.org; Fri, 17 Feb 2023 03:29:47 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36982) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSw7l-0006pf-BZ for 61521-done@debbugs.gnu.org; Fri, 17 Feb 2023 03:29:45 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSw7f-0006Jf-S9; Fri, 17 Feb 2023 03:29:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ynDnIMrLltS1ETM/gbYtIJ7GbEJyZ2TxGrzh/V6VqZE=; b=B8m5fwm4m1q4 fnaG56bBSG5GsViwu1NtVtNK9Xgfb3sNfl5FF5hPotP2DYobO0cC6HX9QnN9UAH7jcvx/oF3pOJoi lz35dQVviSV2l5NGUvP/H3aZ1xLRDoCjEX1D8pv/QoEpyCid4pi1w2SXIoXm5UTiz15Bu4Ko5Sk5i ZqyGVDjnmksMEkCdQEP4KilwH9P/f16q3awJdqUbipIFE59RZxRv5DmsXWVS9vXNClXSpzk6zG3Oa EBEG5lZtddd7Zmt8DeCSwPHzpgaXacoYNvcAvGz48xa+fLtKVw/CnCfGKTXyFK2SO/G3CFqv4fNwV 56qmD4028xb0q+OUTNqzNg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSw7f-000555-CX; Fri, 17 Feb 2023 03:29:39 -0500 In-Reply-To: <05d313ea-7355-189f-62b0-1ba439ff0acf@umanwizard.com> (message from Brennan Vincent on Wed, 15 Feb 2023 11:19:54 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:255864 Archived-At: > Date: Wed, 15 Feb 2023 11:19:54 -0500 > Cc: 61521@debbugs.gnu.org > From: Brennan Vincent > > > 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.