From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Re: Fwd: Re: Patch file for colorize module Date: Mon, 04 Jun 2018 12:03:02 +0200 Message-ID: <87zi0a3m3t.fsf@elephly.net> References: <8ea5d026-fab9-7b12-198e-610ad7743cb2@swecha.net> <87o9hycwl6.fsf@elephly.net> <87r2mhdeap.fsf@elephly.net> <618c131c-6ba6-e525-aefc-72acca1c910f@swecha.net> <87a7suwtp7.fsf@elephly.net> <149bfb8c-22b5-797d-e88a-ca4077b0a4cc@swecha.net> <87d0xmok8e.fsf@elephly.net> <87k1rsb9ex.fsf@elephly.net> <3e099b0b-e3ec-2bbb-6d10-5b7e48c4dff6@swecha.net> <300fd917-6742-3ef1-044d-4b0f38a44250@swecha.net> <87a7sm4v5j.fsf@elephly.net> <3d5eca09-7730-bd38-265b-7942d0ea16ed@swecha.net> <878t864i59.fsf@elephly.net> <87o9gwpcmx.fsf@elephly.net> <2f71be8d-c672-c66a-0b16-bc3abc748754@swecha.net> <877enjpquf.fsf@elephly.net> <557b30de-5aa2-113f-7e90-a4a23e86bb07@swecha.net> <87602zbrcc.fsf@elephly.net> <328742c6-f96f-74b8-68ef-3b165a6199aa@swecha.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPma2-0004YM-NS for guix-devel@gnu.org; Mon, 04 Jun 2018 06:19:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPma0-0003l3-H9 for guix-devel@gnu.org; Mon, 04 Jun 2018 06:19:14 -0400 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21120) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fPma0-0003km-8C for guix-devel@gnu.org; Mon, 04 Jun 2018 06:19:12 -0400 In-reply-to: <328742c6-f96f-74b8-68ef-3b165a6199aa@swecha.net> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Sahitihi Cc: guix-devel Hi Sahithi, > I used /cond/ conditional and gave a try. This worked out with > following line.[=E2=80=A6] Good. Currently, you have always the same code that runs for any match. Looking at my example you might be able to figure out how to apply a different colour to different parts of the strings, e.g. using blue for the name of the build phase and green for the rest. You will need to use regular expressions with sufficient match groups. Here=E2=80=99s the example from my email again: --8<---------------cut here---------------start------------->8--- (define str "My name is Al Jarreau and I=E2=80=99m 76 years old.") (define expr "(My name is )(.*)( and I=E2=80=99m )(.*)( years old.)") These are five match groups and we want to modify the second and fourth, so we can do this: (or (and=3D> (string-match expr str) (lambda (m) (string-append (match:substring m 1) (string-upcase (match:substring m 2)) (match:substring m 3) (string-reverse (match:substring m 4)) (match:substring m 5)))) ;; Didn=E2=80=99t match, so return unmodified string. str) --8<---------------cut here---------------end--------------->8--- Please make an effort to make the changes in (guix ui) as soon as you understand how it=E2=80=99s done. Thanks! -- Ricardo