From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25525: 25.1.90; add color highlighting to css mode Date: Sun, 05 Mar 2017 17:34:41 +0200 Message-ID: <83efybka9a.fsf@gnu.org> References: <87mvefh8br.fsf@tromey.com> <1485375833.1960.0@smtp.gmail.com> <1485455113.4245.1@smtp.gmail.com> <1487359774.1998.0@smtp.gmail.com> <1488653191.6153.0@smtp.gmail.com> <87mvd0igv9.fsf@tromey.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1488728180 16020 195.159.176.226 (5 Mar 2017 15:36:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 5 Mar 2017 15:36:20 +0000 (UTC) Cc: 25525@debbugs.gnu.org, simenheg@gmail.com To: Tom Tromey Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 05 16:36:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckYCf-0002pG-SG for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Mar 2017 16:36:10 +0100 Original-Received: from localhost ([::1]:39156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckYCk-0006ZJ-2S for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Mar 2017 10:36:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckYCc-0006ZD-Hy for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2017 10:36:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckYCZ-0000mp-EJ for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2017 10:36:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42918) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ckYCZ-0000mk-Bu for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2017 10:36:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ckYCY-00062c-3F for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2017 10:36:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Mar 2017 15:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 25525-submit@debbugs.gnu.org id=B25525.148872810223150 (code B ref 25525); Sun, 05 Mar 2017 15:36:02 +0000 Original-Received: (at 25525) by debbugs.gnu.org; 5 Mar 2017 15:35:02 +0000 Original-Received: from localhost ([127.0.0.1]:41117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckYBa-00061K-8S for submit@debbugs.gnu.org; Sun, 05 Mar 2017 10:35:02 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckYBY-00060o-UO for 25525@debbugs.gnu.org; Sun, 05 Mar 2017 10:35:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckYBQ-0000OJ-Jf for 25525@debbugs.gnu.org; Sun, 05 Mar 2017 10:34:55 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckYBQ-0000OF-Gw; Sun, 05 Mar 2017 10:34:52 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1405 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ckYBP-0004Ae-Tk; Sun, 05 Mar 2017 10:34:52 -0500 In-reply-to: <87mvd0igv9.fsf@tromey.com> (message from Tom Tromey on Sat, 04 Mar 2017 19:42:34 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:130208 Archived-At: > From: Tom Tromey > Cc: Tom Tromey , 25525@debbugs.gnu.org, Eli Zaretskii > Date: Sat, 04 Mar 2017 19:42:34 -0700 > > >>>>> "Simen" == Simen Heggestøyl 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?