From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dave Goel Newsgroups: gmane.emacs.devel Subject: Faces: How to clear an attribute while continuing to inherit other attributes? Date: Wed, 9 Oct 2019 22:42:50 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000002e96b70594855c51" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="231035"; mail-complaints-to="usenet@blaine.gmane.org" To: emacs-devel@gnu.org, Dave Goel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 10 04:43:37 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iIOQS-000xvk-Gb for ged-emacs-devel@m.gmane.org; Thu, 10 Oct 2019 04:43:36 +0200 Original-Received: from localhost ([::1]:33504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIOQR-0006gm-Ai for ged-emacs-devel@m.gmane.org; Wed, 09 Oct 2019 22:43:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55322) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIOPw-0006gc-Gb for emacs-devel@gnu.org; Wed, 09 Oct 2019 22:43:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iIOPv-00056G-Dn for emacs-devel@gnu.org; Wed, 09 Oct 2019 22:43:04 -0400 Original-Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]:38780) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iIOPv-000560-8d for emacs-devel@gnu.org; Wed, 09 Oct 2019 22:43:03 -0400 Original-Received: by mail-io1-xd30.google.com with SMTP id u8so10324783iom.5 for ; Wed, 09 Oct 2019 19:43:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=xns6LH76E5WG832UxfMPTjyjrh/7Mkl+FcZMfXSjeKs=; b=Y7eISs5noWUy9gLuHRnKoM2+JSl0HsYRqiCBGquTk0A5g6dc7O8ED5XdS+oR9fA+MR gikW1YtpmyqBZGaZnDUfxdZA8vxHgISXYC1abx/iIkHB5sNnfMGC5aPiX49FbnuLXNaA 6D/D/gn/IEy35eNdsAtyTsaWcX+AEcr+Dcu13dZptFFB7Wwc6KiCXfXc+2Cp28c8aTKb KQGBeECXIrTOavvd7e3KBDzGbK/7Q1igNOkSlN1/LDGbD93CK+TkWAW532iZZTnbjI+i dzkNTOG7X9Vz6CIyJBULoxbq32haHpdmlaQ4o+Vm3RZ08zA0wIAPNtApAv6BUO6BdC0v kMNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=xns6LH76E5WG832UxfMPTjyjrh/7Mkl+FcZMfXSjeKs=; b=WqVjc2PQRDXmO+2V5t75jiNkrCHQE65lt8EANiQPSagyw9LtTF5LnfrotB7/njDJEv NTAVOXzIb1VB4zdf0eBue99XVuXPplYVTxImkaodrMWHtBTYE1jKn9T6EAA0WBWPkBH1 q5xGFCH8zEHPNnvpX70SuDFpoIAfiAocy1MVSYg4Grm9crJLwrnXuZ3B26UCtD1W38fu 9Vh7kCV3Wjks0YVqFksMaC9wP6LrvJZf0njQUWjtbhdwuINWuIp72EpNhopJmhiHlsQL fPqbRHNe6d7ZXRU7tYCww2Bp//HG61qWiWOAuto2xPUkR9zXv5igvQIqjRaTAxLMiIFD dxTQ== X-Gm-Message-State: APjAAAWN/0fe46+b3IOK4LpapYfQaB7DB55d+ZVVFnxzaoChwIBBVHTW fiagC67ovr/S3OLxyDB6Zx4E/Ez5Wi6VjsnGuaM7Mz0D X-Google-Smtp-Source: APXvYqxpxnFu9DFFfCo9jYKuuyNEm+pDwzR9quAIKNgZAa5/EZKwPhyYRbfSPRVlYhj2gsoEjEq1i80fQB/6IC0t3A8= X-Received: by 2002:a5d:8f8e:: with SMTP id l14mr7626005iol.107.1570675381669; Wed, 09 Oct 2019 19:43:01 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::d30 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240811 Archived-At: --0000000000002e96b70594855c51 Content-Type: text/plain; charset="UTF-8" How to unset an inherited face attribute while continuing to inherit other attributes? Face 'a inherits from 'b, which sets foreground to yellow. How do I keep 'a inheriting from 'b, but set the foreground to (nothing), so that actually rendering 'a goes to the default foreground (white) instead of yellow? Emacs allows us to set a's foreground to nil (instead of 'unspecified), but it magically becomes 'unspecified when queried. That's not what I was aiming for. That is because 'unspecified means actually rendering face 'a would yield yellow, the color inherited from 'b instead of the default foreground. Here's a test: (progn (defface a nil "") (defface b nil "") (set-face-attribute 'b nil :foreground "yellow") (set-face-attribute 'a nil :inherit 'b) (set-face-attribute 'a nil :foreground nil) ;; let's chase how 'a would render: (face-attribute 'a :foreground nil t)) => "yellow" We expected either "white", the default foreground. So, unfortunately, setting a's foreground to nil seems to be equivalent to setting a's foreground to 'unspecified. Once I set it to nil, I edebugged (face-attribute), and it calls ' internal-get-lisp-face-attribute which yields 'unspecified instead of the expected nil. (Please cc replies if you can. I tested all this with emacs24.) Thanks Dave --0000000000002e96b70594855c51 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
How to unset an inherited face attribute whi= le continuing to inherit other attributes?

Face 'a inherits from= 'b, which sets foreground to yellow. How do I keep 'a inheriting f= rom 'b, but set the foreground to (nothing), so that actually rendering= 'a goes to the default foreground (white) instead of yellow?

Em= acs allows us to set a's foreground to nil (instead of 'unspecified= ), but it magically becomes 'unspecified when queried. That's not w= hat I was aiming for. That is because 'unspecified means actually rende= ring face 'a would yield yellow, the color inherited from 'b instea= d of the default foreground.

Her= e's a test:=C2=A0=C2=A0

(progn
=C2=A0 (defface a nil "&q= uot;)
=C2=A0 (defface b nil "")
=C2=A0 (set-face-attribute = =C2=A0'b nil :foreground "yellow")
=C2=A0 (set-face-attrib= ute 'a nil :inherit 'b)
=C2=A0 (set-face-attribute 'a nil :f= oreground nil)
=C2=A0 ;; let's chase how 'a would render:
=C2= =A0 (face-attribute 'a :foreground nil t))

=3D> "yellow&= quot;

We expected either "white", the default foreground.<= br>

So, unfortunately, setting a's foreground to nil seems to be= equivalent to setting a's foreground to 'unspecified.=C2=A0
Once I set it to nil, I edebugged (face-attribute), and it calls =C2=A0= 9; internal-get-lisp-face-attribute which yields 'unspecified instead o= f the expected nil.

(Please = cc replies if you can. I tested all this with emacs24.)
=
Thanks
Dave
<= br>
--0000000000002e96b70594855c51--