From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Re: About the :distant-foreground face attribute Date: Mon, 13 Jan 2014 16:07:49 -0800 Message-ID: <52D47FD5.6060402@dancol.org> References: <87bnzo9cja.fsf@gnu.org> <59B7E7FC-48D0-4737-B1BB-FFAC5BA9E07A@swipnet.se> <874n5f3162.fsf@gnu.org> <83fvozf86g.fsf@gnu.org> <87r48javwe.fsf@gnu.org> <83bnzmfjxe.fsf@gnu.org> <52D3E689.6050902@dancol.org> <8E16225F-53EF-498A-AB35-66EB9B33B859@swipnet.se> <52D43360.6050605@dancol.org> <9BD01B88-AF13-44DD-8DBE-4598BAC136DD@swipnet.se> <52D45C73.6090906@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1389658078 5440 80.91.229.3 (14 Jan 2014 00:07:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 Jan 2014 00:07:58 +0000 (UTC) Cc: Eli Zaretskii , =?ISO-8859-1?Q?Jan_Dj=E4rv?= , Chong Yidong , emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 14 01:08:05 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 1W2rY4-0004QF-R6 for ged-emacs-devel@m.gmane.org; Tue, 14 Jan 2014 01:08:04 +0100 Original-Received: from localhost ([::1]:45727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2rY4-0007IZ-8o for ged-emacs-devel@m.gmane.org; Mon, 13 Jan 2014 19:08:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2rY1-0007IU-Gl for emacs-devel@gnu.org; Mon, 13 Jan 2014 19:08:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2rY0-00021R-MQ for emacs-devel@gnu.org; Mon, 13 Jan 2014 19:08:01 -0500 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:54773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2rXx-00020s-Qd; Mon, 13 Jan 2014 19:07:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=U5uDzOUbKtrAZJWv58s5C5YSOLZtqHBDVHLC2Rfl3G0=; b=oxMqfTls43RwiHfKRESfBNrGMvZ8wBgKbV6bccTZny5hfRHFgxnZbDsvvua2pLYOfRS2OUdrwzy/Wy6H3cqEfiYWHU2XyTOTALvxj1VlgMLI0tcyF+/6cefTv2LGflxpy7HQUlsLFan1SifB1cgNhhs99ef3LovHcprshPhzONjH85IcrBVyFMtBuGgIXcq0gr4+FnVQt5QYt5y2gkJAfNADWq3PatLmWXV1dS5XobE0D6EHBnK7dAOx4idk6l9+7zZUE3zwSLY6xqkCX+GiNe9rmU32LwiH6wgHMkgwgpyuuZYyeknxFPPHKcxcRRoqTQqenQAxYjgcg9kv5mjAYg==; Original-Received: from [2620:0:1cfe:a1:2b5:6dff:fe05:24f5] by dancol.org with esmtpsa (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1W2rXv-00010O-If; Mon, 13 Jan 2014 16:07:55 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 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:168331 Archived-At: On 01/13/2014 03:57 PM, Stefan Monnier wrote: >> If you want the :distant-foreground behavior, it can be accommodated in this >> patch. This patch also permits other schemes that some users might find more >> useful. We should push policy to user customization when possible instead of >> hardcoding policy in the logic of face attributes. > > FWIW, I like the idea of being able to compute the color dynamically. > I also would welcome a way to specify "color filters", e.g. a face which > "darkens the foreground color". IOW the equivalent of the > floating-point :height settings, but for colors. You can write something like that in my setup --- we actually call :contrast-function on every face realization. There's no reason it has to act only on certain conditions, although that's what all the existing implementations do. We could generalize the mechanism --- maybe we could rename :contrast-function to :filter. Then, in merge_face_vectors, we call the supplied filter function with a vector (or alist?) of face attributes. It returns the new set of attributes and we use those instead of the ones we came up with. The filter function could use `color-values' to get RGB information from the raw face color attributes. Doing this on every face lookup would probably be too expensive, but maybe we can (in face_at_buffer_position) first compute properties without filters and look that up in the cache. If we don't find it, we can then compute the properties again, this time applying filters, and cache the result.