bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25525: 25.1.90; add color highlighting to css mode


From: Eli Zaretskii
Subject: bug#25525: 25.1.90; add color highlighting to css mode
Date: Sun, 05 Mar 2017 17:34:41 +0200

> From: Tom Tromey <address@hidden>
> Cc: Tom Tromey <address@hidden>,  address@hidden, Eli Zaretskii 
> <address@hidden>
> Date: Sat, 04 Mar 2017 19:42:34 -0700
> 
> >>>>> "Simen" == Simen Heggestøyl <address@hidden> writes:
> 
> Simen> There is also a test failure when you rebase the patch on the latest
> Simen> master due to the changes in 7b00e956b4. It can be fixed by passing 2
> Simen> as the last argument to `color-rgb-to-hex' in `css--hsl-color'.
> 
> This happens due to the change in 7b00e956b485d8ade03c870cbdd0ae086348737b,
> which changed color-name-to-rgb in a backward-incompatible way.
> Eli, you made this change -- it seems to me that it would be safer if it
> defaulted to 2 digits, which was how it worked previously.  This would
> be backward-compatible and allow the new functionality as well.

If we leave the default at 2, people will never discover they need to
use 4 there, and the original problem which prompted those changes
will be still with us years from now.  The reasons for using 4-digit
(i.e. 16 bits per component) hex specifications are subtle and buried
deep in the Emacs internals related to color calculations.  I don't
expect Lisp programmers to understand those reasons.  I actually
forgot about this subtlety myself, until that bug surfaced.

When I worked on the change, it seemed harmless: the function has only
one caller outside of color.el, and I changed that single caller to
use the optional argument.  css-mode is the second such caller, and if
the code was there when I made the changes, I'd have fixed that as
well.  Both shr-color and css-mode manipulate Web-related color specs,
where 2 hex digits per component are the rule.  That's a niche
application, as far as color management in Emacs is concerned, so,
unfortunate as it is, it's up to the people who develop such
applications to know that they need 2 digits rather than the default
4.

If the change I made is nevertheless deemed too drastic, then what are
our alternatives?  The only one I could think of is to define a new
function and deprecate color-name-to-rgb in favor of that new
function, which will then display warnings when code using it is
compiled, and eventually cause them to make changes in their code
anyway.  Is that better?  Or are there any better ideas?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]