From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: About the :distant-foreground face attribute Date: Wed, 08 Jan 2014 05:57:41 +0800 Message-ID: <874n5f3162.fsf@gnu.org> References: <87bnzo9cja.fsf@gnu.org> <59B7E7FC-48D0-4737-B1BB-FFAC5BA9E07A@swipnet.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1389131917 19032 80.91.229.3 (7 Jan 2014 21:58:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Jan 2014 21:58:37 +0000 (UTC) Cc: emacs-devel To: Jan =?utf-8?Q?Dj=C3=A4rv?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 07 22:58:44 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W0efX-0006W5-2R for ged-emacs-devel@m.gmane.org; Tue, 07 Jan 2014 22:58:39 +0100 Original-Received: from localhost ([::1]:43584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0efW-0006e0-Fs for ged-emacs-devel@m.gmane.org; Tue, 07 Jan 2014 16:58:38 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0eek-0005Rj-76 for emacs-devel@gnu.org; Tue, 07 Jan 2014 16:57:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0eee-0004d8-Ms for emacs-devel@gnu.org; Tue, 07 Jan 2014 16:57:50 -0500 Original-Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]:58225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0eee-0004d2-Ev for emacs-devel@gnu.org; Tue, 07 Jan 2014 16:57:44 -0500 Original-Received: by mail-pa0-f45.google.com with SMTP id fb1so953914pad.18 for ; Tue, 07 Jan 2014 13:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=AKj7JXJ6+m/A+EfZwNID6fb3JoJLs3Gg2c/30oa53qs=; b=E3TNfJfGCSnta8CgN1XoQyqT6y0cXwChtLF9vI0h9w1d0LwEwgiJox2F+/Yxy/PQGQ V61XErApKND3QU2hh2hjb2Dnfd0Sw7r8sN/UpFeHYDPwkkDDdVR+dVzaYL5TO1xrz0iL XTI9k9SF09VH5IWhfms9zM/Wc5ayiy24S91bXFtp2OHNKFq63I/SfY1EVMExne2njkuE WQ8Xyo39fETidA8RNOSEhtQ8ptcpDZ9gZqcxkzdyG1IPyVJ+jPkyuJL6QOIsfuSJTS/M qw3sAdbc5LLR3VjkDNLDavhx+TD8PcN3t2BAU04btnVG7qRNyXJYcixCyF9Ai9IC+auB gGMA== X-Received: by 10.69.29.107 with SMTP id jv11mr18657618pbd.147.1389131863431; Tue, 07 Jan 2014 13:57:43 -0800 (PST) Original-Received: from tsparkle ([65.127.72.2]) by mx.google.com with ESMTPSA id ki1sm138432146pbd.1.2014.01.07.13.57.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jan 2014 13:57:42 -0800 (PST) In-Reply-To: <59B7E7FC-48D0-4737-B1BB-FFAC5BA9E07A@swipnet.se> ("Jan \=\?utf-8\?Q\?Dj\=C3\=A4rv\=22's\?\= message of "Tue, 7 Jan 2014 16:00:14 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:167680 Archived-At: Jan Dj=C3=A4rv writes: > Too lazy to read documentation? > > "`:distant-foreground' > Alternative foreground color, a string. This is like `:foreground' > but the color is only used as a foreground when the background > color is near to the foreground that would have been used. This > is useful for example when marking text (i.e. the region face). > If the text has a foreground that is visible with the region face, > that foreground is used. If the foreground is near the region > face background, `:distant-foreground' is used instead so the text > is readable. I read that, but the explanation was pretty darn cryptic. But OK: from your message, I gather that this feature was introduced to deal with the problem which setting the `region' face from system (GTK or NS) settings. But is there any other even vaguely envisioned usage? Because, as explained before, there are better ways to deal with this problem than something so intrusive as defining a new face attribute. >> First of all, the name :distant-foreground is not intuitive. What does >> "distant" mean in this context? >>=20 > > The same as in any other context, far removed from something else, > i.e. the background. Things that are "distant" are in the BACKGROUND, so "distant foreground" sounds tautological. The fact that there isn't a good name for this face attribute is an indicator that it's not well-conceived. The feature does not fit well with the design of the rest of the face-handling code. We already have a mechanism for checking to see when to use a particular face: the DISPLAY element in a face spec. The :distant-foreground face attribute, by its very existence, is redundant with what the DISPLAY element was meant to do. This adds extra complexity to the design, for no good reason. If you need to check for a background, the right thing would be to extend the DISPLAY feature to do what you need. For example, a DISPLAY element of `(background dark)' is used to test for a dark background. Maybe what you want is to be able to specify a color in place of `dark', which would mean a background close to that color. >> Also, this feature has one ugly consequence. Previously, the `default' >> face must have all its face attributes specified, but now its >> :distant-foreground face is unspecified. > > Default face does not need to have its font specified, so this is not > new. M-: (face-attribute 'default :font) RET =3D> # M-: (face-attribute 'default :distant-foreground) RET =3D> unspecified