From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.bugs Subject: bug#55623: 29.0.50; Mention that (face-foreground 'default) can return "unspecified-fg" Date: Fri, 27 May 2022 00:44:38 -0500 Message-ID: <4a17447f-c07f-b522-67a5-c81136dd4f4e@alphapapa.net> References: <87ilpub287.fsf@gmail.com> <87o7zmjd2f.fsf@yahoo.com> <87czg2aw0q.fsf@gmail.com> <83pmk14uo4.fsf@gnu.org> <878rqpbqxm.fsf@gmail.com> <83tu9dpmlv.fsf@gnu.org> <87o7zla5on.fsf@gmail.com> <83pmk1pl8h.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2092"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Cc: luangruo@yahoo.com, 55623@debbugs.gnu.org To: Eli Zaretskii , Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 27 07:46:09 2022 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 1nuSnY-0000NY-Nn for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 May 2022 07:46:09 +0200 Original-Received: from localhost ([::1]:40740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nuSnX-0001dC-7h for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 May 2022 01:46:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuSmU-0001cs-Cy for bug-gnu-emacs@gnu.org; Fri, 27 May 2022 01:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nuSmT-0007wi-Ve for bug-gnu-emacs@gnu.org; Fri, 27 May 2022 01:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nuSmT-0002NE-Rl for bug-gnu-emacs@gnu.org; Fri, 27 May 2022 01:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Adam Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 May 2022 05:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55623 X-GNU-PR-Package: emacs Original-Received: via spool by 55623-submit@debbugs.gnu.org id=B55623.16536302919092 (code B ref 55623); Fri, 27 May 2022 05:45:01 +0000 Original-Received: (at 55623) by debbugs.gnu.org; 27 May 2022 05:44:51 +0000 Original-Received: from localhost ([127.0.0.1]:60650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nuSmJ-0002Ma-2O for submit@debbugs.gnu.org; Fri, 27 May 2022 01:44:51 -0400 Original-Received: from fuchsia.ash.relay.mailchannels.net ([23.83.222.64]:14607) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nuSmD-0002MK-0o for 55623@debbugs.gnu.org; Fri, 27 May 2022 01:44:49 -0400 X-Sender-Id: dreamhost|x-authsender|inbox@alphapapa.net Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id E8DFB5A12FE; Fri, 27 May 2022 05:44:40 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a295.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 3195C5A12AD; Fri, 27 May 2022 05:44:40 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1653630280; a=rsa-sha256; cv=none; b=crzmb6vGfwyZdFWRFAX5mUYt4FcHZ/eRhYnPhuSuyWJMeaKRAd18Euv8uZnQT1R5ze1e6w 2OkNPUaLQY8hXUN/zNbeCAps1f3QpbQaLA/4vf1MZDVgQMF0cRyxD9Q1GN6VMlUuwdT5NJ H4m7sO6Zt4cgdf3R2wmfBsn8E2JFzUACIdXLsplfmSNZe/G1Ft3PTz8byqT9HG/bR/5tb5 BOZeHQQXT4kMwJ7ThIk4WpVvs4RzlMFXRifN4UjOMDZEVqKSMbwzMAd5tJ5EcvBraTjqMF U6/QCD9qPcty5VmveT7boCPLY/sVTGiZaOQ7SCtZETSdff1qIcaIjbvIvzv86w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1653630280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=d5uUfbNmCtLKw+rANUKhll4XsQWsR0fBCTq9AznWJFA=; b=h3Kahs7GjlUFrAh1dSwLMeEK0uMdbWzKlzduE1qwda9gcrx5irZb+qF0fhVh9DIYOPA2h1 jtDWAffqSjd29fKc7THBiOB15FWwvvbVq6A+cHpE6fVwOmXs2iXftPe42OF14cuajBjjNx +Ryy/MMW/OOjrlSMXCOnuGpHbMrUOCfWIfxZP9RRQsFpPp7WjhY/NrtwZ4EWbJuxaotZaE U+432qXuFTbJCx9RE49hDNZXiN+Qvtx4KMEopo765iIFL34n2DzlS1S2l4VukTqRjLPj5+ CNd9QR3wJlLVHCTFkNvHng//iR+yRctTsr3u6UOTju27qNr7BefuHeeu+bsN8g== ARC-Authentication-Results: i=1; rspamd-68cf9fd8bf-jp5mw; auth=pass smtp.auth=dreamhost smtp.mailfrom=adam@alphapapa.net X-Sender-Id: dreamhost|x-authsender|inbox@alphapapa.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|inbox@alphapapa.net X-MailChannels-Auth-Id: dreamhost X-Imminent-Whistle: 09fa9ef010dc12b1_1653630280740_1003338940 X-MC-Loop-Signature: 1653630280740:3150989889 X-MC-Ingress-Time: 1653630280739 Original-Received: from pdx1-sub0-mail-a295.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.98.242.203 (trex/6.7.1); Fri, 27 May 2022 05:44:40 +0000 Original-Received: from [10.48.0.46] (unknown [45.131.192.13]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: inbox@alphapapa.net) by pdx1-sub0-mail-a295.dreamhost.com (Postfix) with ESMTPSA id 4L8YfH32QRz1Q8; Thu, 26 May 2022 22:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alphapapa.net; s=dreamhost; t=1653630279; bh=c/DVvbp2GVmtDJK4zuaUSH5Vw2ZdGU7lwLTGqrFHTj8=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=Jnbr+n+Gj0N0sAxXGSQpWpZPnqTPqeH+G+/cM1sxZYOlbdXEc6xD39JnuVxRatAax Ojp/RtXfDvW7KXCfXKR8xOnQlnXQBa7rvtTN/i6IaZfLWT2Q5L9kY8czQYUYTV/fKC 7LHCk+2FrWKONAJY7mglZuYtRykBH5hzFV7JsnW6+cSrHJM0Kcx6EDmn/Ki11xeiVo duMlkyO6DiGPpKjzRXetf5oRa4YlMjiYDYSvs6fL+7YYUtnqH4FEELfeIs5vgmToFT iVhmGhx/+0wcJZ8N9Vy5Pq7+5DBN5bgetdg44f+UAPDKEJKRG/jHR90r2Baxoml53V x3+cizhxD9pDw== Content-Language: en-US In-Reply-To: <83pmk1pl8h.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:233144 Archived-At: On 5/25/22 12:37, Eli Zaretskii wrote: >> From: Visuwesh >> Cc: luangruo@yahoo.com, adam@alphapapa.net, 55623@debbugs.gnu.org >> Date: Wed, 25 May 2022 22:52:00 +0530 >> >> How about the following instead then? >> >> The 'default' face is always fully specified except in special cases >> of TTY frames where :foreground and :background attributes may be >> the strings "unspecified-bg" and "unspecified-bg" respectively to >> mean to use the TTY's color for the foreground and background. > > This is inaccurate and thus misleading. These special color names are > just like any other color names, they are "special" only when Emacs > needs to actually use them on the screen. For any other purposes, > they are just color names. Thus, the default face is "fully > specified" even when these colors are used. Also, these colors can be > used by other faces, not just by 'default'. The code in question calls color-gradient on a face's foreground color, using the default face as the fallback: https://github.com/alphapapa/ement.el/blob/fd96491e82a5335058b72aaff7665f0a2c3d4495/ement-room-list.el#L201 (color-gradient (color-name-to-rgb (face-foreground 'ement-room-list-very-recent nil 'default)) (color-name-to-rgb (face-foreground 'ement-room-list-recent nil 'default)) 6) When running on a TTY, face-foreground returns "unspecified-fg", which causes color-name-to-rgb to return nil, which causes color-gradient to signal an error. > Technically, these colors just tell Emacs not to emit a color-changing > command when it writes text to the screen, or emit a command that > tells the terminal driver "reset to your default color". But this is > an implementation detail, and we cannot talk about it in the manual > without explaining a lot of details about the inner workings of color > support on TTY frames. Since the docstring says that the default face is always fully specified, I thought that meant that the default face's foreground would always have a defined, usable color name. Since "unspecified-fg" is not in the manual, and apparently isn't usable by, e.g. color-name-to-rgb (even on a graphical frame; and by "usable", I mean that it returns an expected, useful color name), it seemed like an oversight in the manual to not mention that string somewhere. Theoretically, if "unspecified-fg" were documented somewhere, I could have known that my code needs to account for it. I don't necessarily need to know about the inner workings of color support on a TTY--only that... (face-foreground 'default) ...may return "unspecified-fg" rather than a specific color name, and that, therefore... (color-name-to-rgb (face-foreground 'default)) ...may return nil rather than a color name. I think a sentence or two in the appropriate place could clear this up and prevent users like me from running into this problem. e.g. Note that, on non-graphical frames, the default face's foreground and background colors may be unspecified; in this case, those color names may be the special values "unspecified-fg" and "unspecified-bg", respectively. While these are in some senses legitimate color names in Emacs, not all functions that expect color names as arguments may handle these values as expected, so it may be necessary to check for these special color names before calling such functions with them.