From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Faces: How to clear an attribute while continuing to inherit other attributes? Date: Thu, 10 Oct 2019 21:07:46 +0300 Message-ID: <83pnj4qxsd.fsf@gnu.org> References: <83tv8hrpi6.fsf@gnu.org> <83tv8gqz6u.fsf@gnu.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="255161"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Dave Goel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 10 20:08:10 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 1iIcrA-0014F9-K6 for ged-emacs-devel@m.gmane.org; Thu, 10 Oct 2019 20:08:08 +0200 Original-Received: from localhost ([::1]:42878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIcr9-00050n-8M for ged-emacs-devel@m.gmane.org; Thu, 10 Oct 2019 14:08:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54871) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIcr3-00050c-LS for emacs-devel@gnu.org; Thu, 10 Oct 2019 14:08:02 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iIcr3-0003rn-Hv; Thu, 10 Oct 2019 14:08:01 -0400 Original-Received: from [176.228.60.248] (port=4076 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iIcr2-0005c2-Kh; Thu, 10 Oct 2019 14:08:01 -0400 In-reply-to: (message from Dave Goel on Thu, 10 Oct 2019 13:50:33 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:240851 Archived-At: > From: Dave Goel > Date: Thu, 10 Oct 2019 13:50:33 -0400 > Cc: emacs-devel@gnu.org > > Of course, but that runs counter to the philosophy of inheritance. If you changed the default, you have to then > go back and change all such faces. Not if your code does (set-face-foreground FACE (face-foreground 'default)) With this, if the default face changes the color, FACE will follow suit. You could also try inheriting from both default and another face, although I'm not sure this will do what you want (as I don't yet have a clear idea of what you are trying to do) > Again, if it was something like :underline or :bold or :height, you wouldn't see this problem: setting them to nil > would remove any inheritance, and then, whenever you change the 'default face, your face's final resolved > value automatically uses that. That's because for boolean attributes nil is a valid value, whereas valid values for colors are strings, so nil isn't valid and is taken as unspecified. You must understand that face inheritance is a one-way street: Emacs merges all the faces in the chain starting from default and going down the inheritance chain, so the last face in the chain that specifies a color wins. > It seems that :fg and :bg also try to implement precisely that (providing a nil option as well as 'unspecified), > but then don't do the final step correctly. I don't see anything incorrect in what you describe, it is all expected behavior. > It seems that the design of faces goes out of its way to carefully distinguish nil from 'unspecified, precisely to > allow you to clear an attribute.. See above: I think your conclusion is wrong.