From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Re: Fwd: Re: Patch file for colorize module Date: Sun, 03 Jun 2018 21:30:27 +0200 Message-ID: <87602zbrcc.fsf@elephly.net> References: <8ea5d026-fab9-7b12-198e-610ad7743cb2@swecha.net> <8573e97d-d107-cde6-cd17-35f4ef6d2de3@swecha.net> <87k1takumm.fsf@elephly.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> 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]:39220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPYiv-0003vV-V8 for guix-devel@gnu.org; Sun, 03 Jun 2018 15:31:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPYiv-0002mZ-08 for guix-devel@gnu.org; Sun, 03 Jun 2018 15:31:29 -0400 In-reply-to: <557b30de-5aa2-113f-7e90-a4a23e86bb07@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, > Hi Ricardo, > > I have worked with different possibilities >> Now all you need to do is work on the =E2=80=9Chandle-string=E2=80=9D pr= ocedure. >> >> I suggest using simpler matching procedures at first. To get started >> try =E2=80=9Cstring-prefix?=E2=80=9D and use it with the string =E2=80= =9Cstarting phase=E2=80=9D. This >> won=E2=80=99t work with regular expressions, though. > String-prefix resulted a boolean output so, I thought of using conditiona= ls. > Following is the line I added to =E2=80=9Chandle-string=E2=80=9D procedure > > /(if (string-prefix? "starting phase" str) (colorized-display str > '(GREEN)) (display str target-port) )) Right, this is one way. But as you have seen, =E2=80=9Cstring-prefix?=E2= =80=9D isn=E2=80=99t all that useful for our purposes. You also see that =E2=80=9Cif=E2=80=9D alone is not sufficient here, becaus= e you have more than one expression. You could nest =E2=80=9Cif=E2=80=9D expressions,= but that=E2=80=99s ugly. You can use =E2=80=9Ccond=E2=80=9D instead. > Do I need to write multiple definitions for each expression? > > '("^starting phase.*" > "^phase .* succeeded.*" > "^phase .* failed.*") That=E2=80=99s up to you. You could iterate over a list of expressions or = you can explicitly write a case for each expression. >> If you don=E2=80=99t understand this example please look up the procedur= es in >> the Guile manual. > > I dint find this example in procedures, may I overlooked somewhere I > recheck it. Please look at the examples in my previous email again. I used =E2=80=9Cstring-match=E2=80=9D, =E2=80=9Cmatch:substring=E2=80=9D, and =E2= =80=9Cand=3D>=E2=80=9D, which you may not be familiar with yet. I think these are enough hints. I=E2=80=99d be happy if you could try to implement a bit more than a single =E2=80=9Cif=E2=80=9D expression and send= us your draft implementation within the next few days. If you have questions please feel free to ask for help on #guile or #guix. I=E2=80=99d like us to increase the speed a little, because we seem to be spending too much time on introductory work. -- Ricardo