From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: master 64e25cd: More robust NS hex colour string parsing Date: Sat, 13 Jun 2020 18:58:31 +0300 Message-ID: <83y2or2c0o.fsf@gnu.org> References: <20200608120746.30163.87810@vcs0.savannah.gnu.org> <20200608120747.80E8E20A2E@vcs0.savannah.gnu.org> <83r1uk429y.fsf@gnu.org> <3C92A091-F389-4179-B2F0-B3AA5ABD6CCE@acm.org> <83pna43xrl.fsf@gnu.org> <9259B4A6-F3CC-4243-9F08-2882993C9B2C@acm.org> <83a71741mr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="38440"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pipcet@gmail.com, emacs-devel@gnu.org To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 13 17:59:15 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jk8Yt-0009rJ-AD for ged-emacs-devel@m.gmane-mx.org; Sat, 13 Jun 2020 17:59:15 +0200 Original-Received: from localhost ([::1]:33850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk8Ys-00026g-79 for ged-emacs-devel@m.gmane-mx.org; Sat, 13 Jun 2020 11:59:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jk8YL-0001f0-LW for emacs-devel@gnu.org; Sat, 13 Jun 2020 11:58:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59115) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk8YL-0001hO-2g; Sat, 13 Jun 2020 11:58:41 -0400 Original-Received: from [176.228.60.248] (port=3238 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jk8YK-0004yh-0q; Sat, 13 Jun 2020 11:58:40 -0400 In-Reply-To: (message from Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sat, 13 Jun 2020 17:39:29 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:252183 Archived-At: > From: Mattias EngdegÄrd > Date: Sat, 13 Jun 2020 17:39:29 +0200 > Cc: pipcet@gmail.com, emacs-devel@gnu.org > > Try (color-values "#123"). The correct result is (#x1111 #x2222 #x3333). Why is that the correct value? I get (#x1010 #x2020 #x3030); why is that wrong? > >> Not sure what you mean here. Mind giving a concrete example? > > > > The first two branches of the 'cond' would always return a list before > > your changes, but after your changes they could return nil if > > color-values-from-numeric-string (not the best name, btw) returns nil > > and the input is of one of the two forms parsed by those two branches. > > This is still a tad vague and speculative. Just follow the code, it should be very clear: those two branches always return a list of values. No example should be needed. > As far as I can tell, well-formed arguments yield correct values and > others are rejected in the same way as before No, that's not true, as should be obvious from examining the code. Previously, any "#..." string whose length was 4 or longer would return a list of values, even if it wasn't well-formed; now some of them will return nil. > I don't particularly like that function name either. What about one of these: > > parse-color > parse-color-spec > parse-color-string > color-values-from-spec > color-from-string-spec > color-spec-to-values color-values-from-rgb-spec?