all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: "Drew Adams" <drew.adams@oracle.com>, "Jan Djärv" <jan.h.d@swipnet.se>
Cc: Eli Zaretskii <eliz@gnu.org>, Chong Yidong <cyd@gnu.org>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: [PATCH] Re: About the :distant-foreground face attribute
Date: Tue, 14 Jan 2014 14:38:49 -0800	[thread overview]
Message-ID: <52D5BC79.7050706@dancol.org> (raw)
In-Reply-To: <2798eddb-c6c7-4b73-8bd0-e4bd72f3405e@default>

Thanks. This is productive.

On 01/14/2014 11:32 AM, Drew Adams wrote:
>>> Emacs should act that way by default, as it always has.  Anyone
>>> who wants automatic foreground twiddling for a given face should
>>> ask for that explicitly.  Whether that twiddling is to accommodate
>>> font-locking or for some other reason.
>>
>> I don't have a strong opinion about the default, although I lean
>> toward the behavior #3 (3b specifically) below since it looks
>> blingy and might help attract new users.
>
> Bof.  Today's sparkling blingy is tomorrow's annoying.

Fair enough, but it looks like we're going to go with some variant of #3 
(according to Stefan's latest message), so we might as well choose the 
least objectionable #3 variant.

> And note that the "problem", of text highlighted by the selection
> (region) having foreground and background the same, is the same
> problem you will anyway encounter for Isearch.  In your example,
> even when searching you can run into the same problem.
>
> Will you be proposing that Isearch highlighting too let font-lock
> highlighting show through?  There is a reason we give Isearch
> highlighting such a high priority: it should clearly _highlight_
> text - even text that might be font-locked.

If I had my druthers, we'd turn on :contrast-function for the default 
face. It's not generally possible for packages written by arbitrary 
third parties to coordinate color choices in the presence of arbitrary 
themes. Most packages can base colors on existing font-lock faces, but 
font-lock has a limited built-in palette and plenty of packages define 
entirely new faces with arbitrary colors. Automatic adjustment can make 
these faces readable no matter the circumstances of their use.

I'm trying to be conservative by applying automatic contrast adjustment 
only to region right now, since it's this face, being based on system 
colors, that has the highest risk of being unreadable.

>>> A face being equal to its default setting does not imply
>>> that the user gives Emacs license to change it.
>>
>> I disagree. If our user leaves a face at the default setting, she's
>> giving us *explicit license* to use whatever heuristics we think
>> work best.
>
> And how does she specify to you that the default colors are exactly
> what she happens to prefer?  How does she produce the same effect as
> if the default colors were different and she customized them to be
> what the default colors actually are?  How does she tell you
> "Hands off!  This is really what I want!"?

She shouldn't have to, because if she chooses reasonable colors, the 
automatic adjustment will never go into effect. If she really wants to 
customize the region face so that it is illegible, she can uncheck 
:contrast-function.

>> If a user never expressed a preference with respect to foreground
>> and background colors, there's no contract to violate.
>
> And how does she express that preference, if it happens to coincide
> with the default colors?

See above.

> What you are saying is like saying that you think you have a license
> to change the value of option `default-frame-alist' automatically,
> if the current value is nil, because that's also the default value.

Well, yes, we do have such a license. By this logic, we can't change any 
default ever.

>> Right now, it depends on the order in which the faces are merged.
>> The last face that specifies a :contrast-function gets to control the
>> contrast behavior.
>
> Users are going to have trouble with that complication.  Too much
> wondering about what happened and why.  Of course, I could be wrong.

I don't think it's any more confusing than other aspects of the face 
model --- or CSS, for that matter. Sure, the model is complex, but it's 
powerful.

>> Right now, region is the only face that specifies a
>> contrast-function, and I can't think of another good use case at
>> the moment.
>
> Maybe that in itself should tell you something...

See the discussion of generality above. Personally, I'd like to apply 
automatic adjustment (or other filters) more broadly, but for now, it 
makes sense to be conservative, which means applying the adjustment only 
to region.

>>> But it still makes life more complicated for Lisp code that
>>> wants to get or set the actual appearance of the face.  Whereas
>>> before code needed only to get or set attribute :foreground,
>>> now it will need to also check for a non-nil :contrast-function
>>> and apply that.
>>
>> I don't understand why lisp code would need to know the
>> post-adjustment colors used for display. Can you explain why
>> we'd want to know?
>
> Lisp code that checks or changes a given color attribute is trying
> to check or affect the actual appearance of the face (again, not
> considering merges with other faces etc.).
>
> Doing this breaks the one-to-one relationship between the face's
> attributes and its appearance.

But there's only a one-to-one relationship if the face is fully 
specified --- this patch doesn't change that.

> That means that the Lisp code cannot
> just examine or set `foreground' and `background' colors.  It will
> need to be changed to also invoke the :contrast-function.  Or if
> that takes effect automatically, it will need to be aware that that
> can happen, and perhaps even accommodate it to cancel it out
> (depending on the purpose of the Lisp code).
>
> Consider code that does something based on distance of the current
> foreground appearance from some given value - the same kind of thing
> you are doing with a given :contrast-function, for instance.  It
> will no longer be sufficient to just measure the distance to the
> current `foreground' attribute value.  Now, it will need to invoke
> the current :contrast-function too, to accurately estimate the
> distance.
>
>> Also, today, any lisp code that wants to mimic the redisplay face
>> combination logic needs to take into account text properties,
>> frame-local variables, overlays, display attributes, and so on. It
>> would be a big job, and I'm not aware of anyone who's done it.
>
> I specifically spoke of the color attributes for an individual face,
> and separated this from combining faces and other display properties.
>
> Consider a Lisp function that helps you customize the foreground
> and background colors of an individual face.  What it checks and what
> it produces should reflect the face appearance (again, in isolation).
>
> Consider a function that lets you modify the foreground of a given
> face incrementally, showing you the effect, WYSIWYG-style, in your
> buffer of C code or whatever.  Maybe it increments hue or saturation
> or the blue component.  With your feature, what you see by its
> changing attribute `foreground' will presumably "jump" when the
> :contrast-function decides that the new value would be too close to
> the background.

Yes, that's what would happen, but an editor of this sort --- and I'm 
not aware of any that currently exist --- can just explicitly turn off 
the adjustment, either at the face level or through an overlay in the 
preview area. We should optimize emacs as a text editor, not a precise 
color picker or a floor wax. :-)



  reply	other threads:[~2014-01-14 22:38 UTC|newest]

Thread overview: 134+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 12:55 About the :distant-foreground face attribute Chong Yidong
2014-01-07 15:00 ` Jan Djärv
2014-01-07 17:28   ` Drew Adams
2014-01-07 18:01     ` Eli Zaretskii
2014-01-07 18:09     ` Joel Mccracken
     [not found]     ` <<8361pvsmbk.fsf@gnu.org>
2014-01-07 18:44       ` Drew Adams
2014-01-07 19:01         ` Eli Zaretskii
     [not found]         ` <<83zjn7r4z3.fsf@gnu.org>
2014-01-07 19:06           ` Drew Adams
2014-01-07 19:15             ` Eli Zaretskii
2014-01-07 21:57   ` Chong Yidong
2014-01-08  3:45     ` Eli Zaretskii
2014-01-08  5:24       ` Chong Yidong
2014-01-08  9:35         ` Jan Djärv
2014-01-08  9:52           ` Chong Yidong
2014-01-08 10:10             ` Jan Djärv
2014-01-08 14:49               ` Chong Yidong
2014-01-08 16:37                 ` Jan Djärv
2014-01-08 17:08                   ` Drew Adams
2014-01-08 16:57                 ` Drew Adams
2014-01-08 14:05         ` Stefan Monnier
2014-01-08 17:43         ` Eli Zaretskii
2014-01-09 16:15           ` Chong Yidong
2014-01-09 17:02             ` Stefan Monnier
2014-01-09 17:07               ` Drew Adams
2014-01-09 17:46                 ` Eli Zaretskii
2014-01-09 18:21                   ` Chong Yidong
2014-01-09 22:25                     ` Drew Adams
2014-01-09 22:48                     ` David Engster
2014-01-12 11:14                       ` David Engster
2014-01-12 11:40                         ` Jan Djärv
2014-01-12 12:21                           ` David Engster
2014-01-12 12:56                             ` Jan Djärv
2014-01-12 13:07                               ` David Engster
2014-01-12 13:17                                 ` Jan Djärv
2014-01-12 20:14                         ` Chong Yidong
2014-01-12 21:20                           ` Drew Adams
2014-01-12 22:07                           ` Jan Djärv
2014-01-13  0:57                             ` Drew Adams
2014-01-12 22:59                           ` Stefan Monnier
2014-01-13  4:14                             ` chad
2014-01-09 17:05             ` Eli Zaretskii
2014-01-09 17:22               ` David Engster
2014-01-09 17:27                 ` Lars Magne Ingebrigtsen
2014-01-09 17:50                   ` Jan D.
2014-01-09 20:58                 ` Darren Hoo
2014-01-09 21:17                   ` David Engster
2014-01-09 22:29                     ` Darren Hoo
2014-01-09 22:25                   ` Drew Adams
2014-01-09 22:24                 ` Drew Adams
2014-01-09 17:39               ` Josh
2014-01-09 17:57                 ` Eli Zaretskii
2014-01-09 17:49               ` Jan D.
2014-01-13 13:13           ` [PATCH] " Daniel Colascione
2014-01-13 16:27             ` Jan Djärv
2014-01-13 16:33             ` Jan Djärv
2014-01-13 18:41               ` Daniel Colascione
2014-01-13 21:29                 ` Jan Djärv
2014-01-13 21:36                   ` Daniel Colascione
2014-01-13 23:01                     ` Drew Adams
2014-01-13 23:11                       ` Daniel Colascione
2014-01-14  1:32                         ` Drew Adams
2014-01-14  1:45                           ` Stefan Monnier
2014-01-14 19:32                             ` Drew Adams
2014-01-14  2:34                           ` Daniel Colascione
2014-01-14 19:32                             ` Drew Adams
2014-01-14 22:38                               ` Daniel Colascione [this message]
2014-01-15  0:31                                 ` Drew Adams
2014-01-15  0:54                                   ` Daniel Colascione
2014-01-15  3:07                                     ` Drew Adams
2014-01-15  3:52                                       ` Daniel Colascione
2014-01-15  4:59                                         ` Drew Adams
2014-01-15  5:12                                           ` Daniel Colascione
2014-01-15  5:39                                             ` Drew Adams
2014-01-15 14:38                                               ` Stefan Monnier
2014-01-15  4:50                               ` Yuri Khan
2014-01-15  7:50                                 ` Jan D.
2014-01-15  7:52                                   ` Daniel Colascione
2014-01-15  8:17                                     ` Jan D.
2014-01-15 17:23                                     ` Drew Adams
2014-01-13 23:57                     ` Stefan Monnier
2014-01-14  0:07                       ` Daniel Colascione
2014-01-14  1:45                         ` Stefan Monnier
2014-01-14  2:41                           ` Daniel Colascione
2014-01-14  8:47                       ` Chong Yidong
2014-01-14  9:42                         ` Jan D.
2014-01-14 19:32                       ` Drew Adams
2014-01-14  7:47                     ` Jan D.
2014-01-14  8:18                       ` Daniel Colascione
2014-01-14  9:34                         ` Jan D.
2014-01-14 10:44                           ` Daniel Colascione
2014-01-14 11:44                             ` Jan D.
2014-01-14 17:56                               ` Stefan Monnier
2014-01-14 18:06                                 ` Jan Djärv
2014-01-14 18:31                                   ` Daniel Colascione
2014-01-14 18:51                                 ` John Yates
2014-01-14 22:19                                   ` Stefan Monnier
2014-01-14 18:47                               ` Daniel Colascione
2014-01-14 20:01                                 ` Jan Djärv
2014-01-14 20:06                                   ` Daniel Colascione
2014-01-14 22:05                                     ` [PATCH] " Jan Djärv
2014-01-14 22:14                                       ` Daniel Colascione
2014-01-15  6:33                                         ` Jan Djärv
2014-01-15  8:05                                           ` Daniel Colascione
2014-01-15  9:25                                             ` Jan D.
2014-01-15 14:43                                               ` Stefan Monnier
2014-01-14 20:39                                   ` [PATCH] " Daniel Colascione
2014-01-14 21:58                                     ` [PATCH] " Jan Djärv
2014-01-14 22:06                                       ` Drew Adams
2014-01-15  3:52                                         ` Eli Zaretskii
2014-01-15  4:22                                       ` Stefan Monnier
2014-01-15  4:25                                         ` Daniel Colascione
2014-01-15  6:39                                           ` Jan Djärv
2014-01-15 15:39                                           ` Eli Zaretskii
2014-01-15 14:41                                         ` Stefan Monnier
2014-01-15 15:38                                         ` Eli Zaretskii
2014-01-15 16:17                                           ` Stefan Monnier
2014-01-15 16:53                                             ` Eli Zaretskii
2014-01-15 17:33                                               ` Stefan Monnier
2014-01-15 17:51                                                 ` Eli Zaretskii
2014-01-15 18:43                                                   ` Stefan Monnier
2014-01-15 19:06                                                     ` Eli Zaretskii
2014-01-15 20:05                                                       ` Josh
2014-01-15 20:40                                                         ` Eli Zaretskii
2014-01-15 21:03                                                           ` Daniel Colascione
2014-01-15 21:12                                                             ` Eli Zaretskii
2014-01-15 21:15                                                               ` Daniel Colascione
2014-01-15 21:31                                                             ` John Yates
2014-01-15 22:11                                                             ` Drew Adams
2014-01-15 23:58                                                     ` Stefan Monnier
2014-01-07 22:50   ` Jan Djärv
2014-01-08  3:13 ` Darren Hoo
     [not found] <<87bnzo9cja.fsf@gnu.org>
     [not found] ` <<59B7E7FC-48D0-4737-B1BB-FFAC5BA9E07A@swipnet.se>
     [not found]   ` <<874n5f3162.fsf@gnu.org>
     [not found]     ` <<83fvozf86g.fsf@gnu.org>
     [not found]       ` <<87r48javwe.fsf@gnu.org>
     [not found]         ` <<83bnzmfjxe.fsf@gnu.org>
     [not found]           ` <<87bnzlyvwb.fsf@gnu.org>
     [not found]             ` <<jwvppo1dr9r.fsf-monnier+emacs@gnu.org>
     [not found]               ` <<b53f01f5-1974-417a-b95b-a7e1b6906467@default>
     [not found]                 ` <<83wqi9cakl.fsf@gnu.org>
2014-01-09 21:12                   ` Drew Adams
2014-01-09 21:22                     ` Eli Zaretskii
     [not found]           ` <<52D3E689.6050902@dancol.org>
     [not found]             ` <<8E16225F-53EF-498A-AB35-66EB9B33B859@swipnet.se>
     [not found]               ` <<52D43360.6050605@dancol.org>
     [not found]                 ` <<9BD01B88-AF13-44DD-8DBE-4598BAC136DD@swipnet.se>
     [not found]                   ` <<52D45C73.6090906@dancol.org>
     [not found]                     ` <<52D4EBA9.8050802@swipnet.se>
     [not found]                       ` <<52D4F2C2.8080800@dancol.org>
     [not found]                         ` <<52D504A7.80104@swipnet.se>
     [not found]                           ` <<52D514FF.7010404@dancol.org>
     [not found]                             ` <<52D52312.6070106@swipnet.se>
     [not found]                               ` <<52D58632.3010106@dancol.org>
     [not found]                                 ` <<381DEBDC-71D8-4FAC-BA55-897FEC73A2FC@swipnet.se>
     [not found]                                   ` <<52D5A072.5010508@dancol.org>
     [not found]                                     ` <<064CFFB5-6E50-40D5-B2CB-2BECC656D93F@swipnet.se>
     [not found]                                       ` <<174db5f5-db14-4484-a2f9-9478d2f5fea1@default>
     [not found]                                         ` <<83y52h52cd.fsf@gnu.org>
2014-01-15  3:56                                           ` [PATCH] " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52D5BC79.7050706@dancol.org \
    --to=dancol@dancol.org \
    --cc=cyd@gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.