From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/64337 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: colors for pretty-printing Date: Tue, 7 Dec 2010 12:57:17 -0500 (EST) Message-ID: References: <20101203081711.GA5447@micropit.couberia.bzh> <27ce4c9b-5e21-4df4-91b5-af4bbbb550c6@email.android.com> <20101203213121.GA6937@micropit.couberia.bzh> <4CF9634B.1030605@wxs.nl> <4CF9A816.1080800@nibua-r.org> <4CFAF3A5.5030405@nibua-r.org> <4CFCA4BA.1010609@wxs.nl> <20101206140427.GB29676@micropit.couberia.bzh> <4CFD3FB6.6000207@nibua-r.org> <20101207112502.GA10103@micropit.couberia.bzh> <4CFE3B3C.6020901@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1268162764-1291744643=:28039" X-Trace: dough.gmane.org 1291745373 17203 80.91.229.12 (7 Dec 2010 18:09:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 7 Dec 2010 18:09:33 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Dec 07 19:09:29 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQ1yi-0005aY-Cm for gctc-ntg-context-518@m.gmane.org; Tue, 07 Dec 2010 19:09:28 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 26525CA924; Tue, 7 Dec 2010 19:09:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id N1EiaYmZop6m; Tue, 7 Dec 2010 19:08:54 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 62AE7CA91E; Tue, 7 Dec 2010 19:08:54 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id DD3A2CA91E for ; Tue, 7 Dec 2010 19:08:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id LgbXjudbaTj5 for ; Tue, 7 Dec 2010 19:08:27 +0100 (CET) Original-Received: from filter3-nij.mf.surf.net (filter3-nij.mf.surf.net [195.169.124.154]) by balder.ntg.nl (Postfix) with ESMTP id 4E84ECA91D for ; Tue, 7 Dec 2010 19:08:26 +0100 (CET) Original-Received: from hackers.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.81]) by filter3-nij.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id oB7I8NT5004239 for ; Tue, 7 Dec 2010 19:08:25 +0100 Original-Received: FROM [10.0.2.15] (Mismatch [122.173.75.152]) By hackers.mr.itd.umich.edu ID 4CFE7815.3E456.27003 ; Authuser adityam; 7 Dec 2010 13:08:21 EST In-Reply-To: <4CFE3B3C.6020901@wxs.nl> User-Agent: Alpine 2.01 (LNX 1266 2009-07-14) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.14.81; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0dDEi8ozH - f0fd91a6939b - 20101207 X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.154 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:64337 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1268162764-1291744643=:28039 Content-Type: TEXT/PLAIN; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 7 Dec 2010, Hans Hagen wrote: > On 7-12-2010 2:29, Aditya Mahajan wrote: >> On Tue, 7 Dec 2010, Peter M=FCnster wrote: >>=20 >>> On Mon, Dec 06 2010, Renaud AUBIN wrote: >>>>=20 >>>> Concerning the color abstraction patch, one needs just to overload >>>> Ccomment, Cpreproc, Cstring, Ctype, Ckeyword, Cname and Cfuncnbound to >>>> use custom color scheme. >>>=20 >>> You don't need that. There is already a standard interface for color >>> and style >>> configuration. Example: >>>=20 >>> \setupstartstop[CSnippetComment][color=3Dblue] >>>=20 >>> So you can simplify t-pretty-c.mkiv: >>>=20 >>> \unprotect >>>=20 >>> \setupcolor[ema] >>>=20 >>> \definestartstop >>> [CSnippetName] >>> [\c!color=3Ddarkgoldenrod, >>> \c!style=3D] >>=20 >> I have not looked into the new verbatim code yet, but I have been >> thinking about a similar interface for a new module that uses external >> programs for syntax highlighting (sort of a superset of t-vim that will >> allow one to use other programs like pgyments, etc.). > > it all boils down hooking in a parser then: > > \startluacode > local function parser(s) > local s =3D somexternalthing(s) > -- feedback s > end > > visualizers.register("myparser", { parser =3D parser }) > \stopluacode > > \starttyping[option=3Dmyparser] > .... > \stoptyping Thanks for the explanation. But, I am not too keen to write parsers on my= =20 own when I can easily borrow existing ones. >> Why are you using a C prefix for all environments? Isn't it better to >> use a syntax like this: >>=20 >> \startsetups[verbatim:C] >> \definestartstop[SnippetName][color=3D...,style=3D...] >> \definestartstop[string][color=3D...,style=3D...] >> .... >> \stopsetups >>=20 >> and then pass setups=3Dverbatim:C to an appropriate \setup... command. >> That will make it easy to share the same syntax highlighting between >> different languages. > > it's hard to come up with common names for characteristics for all those= =20 > languages But it does allow you to choose a "color scheme" for pretty printing. This= =20 is similar to how most editors choose color schemes. > but at some point we can have a set predefined as default > > btw, startstop can inherit (now): > > \definestartstop > [MetapostSnippet] > [DefaultSnippet] > > etc so there is no need for setups Setups have an advantage that one does not pollute the cs names. After=20 all, \DefaultSnippet is not useful outside the pretty printing region. An alternative could be to use a namsespace in define in all definitions,= =20 e.g., \definestartstop[visualizer::Snippet] On a related note, does it make sense to add foregroundcolor and=20 foregroupdstyle keys to \definebar? (Then, bars will be an appropriate and= =20 versatile mechanism to define syntax highlighting regions). Aditya --8323328-1268162764-1291744643=:28039 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --8323328-1268162764-1291744643=:28039--