From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kai Ma Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <7fe5e80d-761f-cc2d-12a1-65b2b5781c39@umanwizard.com> <9e9ed8043f57226204db@heytings.org> <3b75cf10-6125-608c-a506-323ce09846c7@umanwizard.com> <9e9ed8043fd479390a2a@heytings.org> <83ttznavsp.fsf@gnu.org> <9e9ed8043fd6413e6183@heytings.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4233"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: brennan@umanwizard.com, Eli Zaretskii , 61521@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 17 23:18:23 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 1pT93f-0000uP-Qe for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 17 Feb 2023 23:18:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pT93M-0003dU-T8; Fri, 17 Feb 2023 17:18:04 -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 1pT93L-0003dC-B6 for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2023 17:18:03 -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 1pT93L-0006X3-2t for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2023 17:18:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pT93K-00043q-Ed for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2023 17:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Kai Ma Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Feb 2023 22:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61521 X-GNU-PR-Package: emacs Original-Received: via spool by 61521-submit@debbugs.gnu.org id=B61521.167667225915578 (code B ref 61521); Fri, 17 Feb 2023 22:18:02 +0000 Original-Received: (at 61521) by debbugs.gnu.org; 17 Feb 2023 22:17:39 +0000 Original-Received: from localhost ([127.0.0.1]:41796 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pT92x-00043C-9D for submit@debbugs.gnu.org; Fri, 17 Feb 2023 17:17:39 -0500 Original-Received: from mail-pj1-f66.google.com ([209.85.216.66]:42817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pT92v-00042z-BW for 61521@debbugs.gnu.org; Fri, 17 Feb 2023 17:17:37 -0500 Original-Received: by mail-pj1-f66.google.com with SMTP id i10-20020a17090a7e0a00b002341a2656e5so2639168pjl.1 for <61521@debbugs.gnu.org>; Fri, 17 Feb 2023 14:17:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=KEnm0GClWGhF9APcRHt6r49/2TsVxCfhDGrTAxGq01I=; b=eqsWtEVIEcZUc+oyKnIMKONnbiKMFTod7nuoJ8XzJYWSyXkZSi2o5Yq1v3z4bA/gVa mmkHxKnAh1zRXKZs1giw5JE4ctMsJyBXI7eCIeBTm4MXaFMFyrhKb8Pgsdp+LQMDK408 2wvSjAK1fhU4ekwllaFu3cBtr+FBg2h6pVb/2I6hylTDTsu0zKLFHsuk7NSbkpsRNrq7 lJRGrspphd/55s4lc1cUSES6XiCr10sBtU4onYs/Mbz1l8cnnONXBEWsPIsIEFQPyiHa 9AMXNLJl+3C37BVEXivixDRVBT5++aSFcq0VZpWHveSOD4fSVYPoL6amWqnCDFBdSKTS wsHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KEnm0GClWGhF9APcRHt6r49/2TsVxCfhDGrTAxGq01I=; b=QRt/7dJy3qtyUPcq+OcsTfdZOmY+CvROU7j+lH5WICbI2SnlSMP4CwwuNvxjRl7gNl 2zO2FNlrEnurIFic/b/hM93+9il/4VKQoSz1GZpd9PfTGtyEfPlXJMZClf+Hsi8quvU7 h86THrxkOn6AF/6JO9yxPNUYwF/Cbms2JovQOdxMmtBxKR5cMagTs/pjCS9mm+7fXQ2H yxUNcc0q6dGoTf1nyBIjIcwN48Ez7YVshhJExrpnd1o8c4hQKhhrmU40bm3hASzx/0p9 iBt7A4KGl6s+v7keVYRynuhQRPWMk9asYZhZPtpwD1vFSfc/Z54QLLniVM1qRBPyaUr4 JSlQ== X-Gm-Message-State: AO0yUKX3iU51e6HCDGIJ7VqcKwFZRNTNZtyaTPT2wybFUd7Kc0OulI3V /T+D+fFi8RvUwPZWin+nRsfYUPhtgAnoNTc32Ko= X-Google-Smtp-Source: AK7set8CYfCpV0BEg4GRFXFCMVYxz7E92htlNTmYsCE8ef4ul5x8/O4xml6dmjsh6ru0w8P9uUuJdQ== X-Received: by 2002:a05:6a20:914a:b0:bf:3def:16cd with SMTP id x10-20020a056a20914a00b000bf3def16cdmr622574pzc.59.1676672250483; Fri, 17 Feb 2023 14:17:30 -0800 (PST) Original-Received: from Kais-MacBook.local ([134.209.106.31]) by smtp.gmail.com with ESMTPSA id d7-20020a656207000000b004fadb547d0csm3168824pgv.61.2023.02.17.14.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Feb 2023 14:17:29 -0800 (PST) In-Reply-To: <9e9ed8043fd6413e6183@heytings.org> (Gregory Heytings's message of "Wed, 15 Feb 2023 14:11:55 +0000") 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:255906 Archived-At: Gregory Heytings 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.