From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 266E1BC69 for ; Tue, 27 Mar 2007 09:34:45 +0200 (CEST) Received: from tintin.inria.fr (tintin.inria.fr [128.93.24.126]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2R7Yisu005941; Tue, 27 Mar 2007 09:34:44 +0200 Date: Tue, 27 Mar 2007 09:34:44 +0200 From: Maxence Guesdon To: caml-list@inria.fr Subject: Re: [Caml-list] cameleon2 Message-ID: <20070327093444.3e324784@tintin.inria.fr> In-Reply-To: <20070326113406.61b3effe@tintin.inria.fr> References: <460530EF.9040507@univ-savoie.fr> <46056F0F.1020907@univ-savoie.fr> <4605B9AE.8050207@univ-savoie.fr> <4606388D.9010902@univ-savoie.fr> <20070326085314.508131d9@tintin.inria.fr> <46078EDE.7@univ-savoie.fr> <20070326113406.61b3effe@tintin.inria.fr> Organization: INRIA X-Mailer: Sylpheed-Claws 2.4.0 (GTK+ 2.4.9; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-j-chkmail-Score: MSGID : 4608C914.001 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 4608C914.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; maxence:01 guesdon:01 maxence:01 guesdon:01 cameleon:01 christophe:01 raffalli:01 christophe:01 raffalli:01 univ-savoie:01 cameleon:01 ocaml:01 ocaml:01 readable:01 distincts:01 On Mon, 26 Mar 2007 11:34:06 +0200 Maxence Guesdon wrote: > On Mon, 26 Mar 2007 11:14:06 +0200 > Christophe Raffalli wrote: > > > > > > > > > Yes indeed. There's a FAQ about this: > > > http://home.gna.org/cameleon/faq.en.html#noocamlsyntaxhighlight > > > > > > I'll add some code to make chamo use an additional directory for > > > languages specs files (used by gtksourceview) when the ocaml mode is > > > not available. > > > > > > > Why not having the make install of either cameleon either > > lablgtksourceview copy ocaml.lang in the general directory (if it is not > > already there) ? Moreover, the distrib of lablgtksourceview has > > ocaml.lang in it. > > On debian/unstable, ocaml.lang is now included in the gtksourceview-common > package. I'm not sure that walking on another package's feet is the right > way to do. But may be testing if the file exists and copy it if it does > not could be ok, indeed. > > > Just another question: Where to find a readable description on > > the customization of Highlighting. I have seen a screen shot mixing > > two distincts fonts in gedit ... but was unable to discover how you do > > that. I found hat the .lang file defines the regexp needed for > > highlighting, but I did not find where to choose the color and fonts ... > > all this seems bably documented > > It's the application's responsability to associate fonts and colors to > syntax elements. By now, Chamo can only make the user choose one font for > all text of a gtksourceview. > What should be done to have different fonts for different syntax elements > is to improve the gtksv_utils module included in cameleon2, which allows > to use gtksourceviews in various (ocaml) applications and share the same > fonts and colors associations to syntax elements. > > For example, topcameleon (a graphical toplevel included in cameleon2) and > chamo share the same colors and fonts for the ocaml syntax mode. > > By now, the associations between style and syntax elements for each mode > are stored in your /.mlgtksourceview directory, one xml file per language. > > I add to the todo list the ability to have a different font associated to > each syntax element. In fact, there is no font attribute in source tag styles of gtksourceviews. I could not find any gedit screenshot showing two distinct fonts in the same gtksourceview. Here is a little explanation about how the gtksourceview works (as I understand it). Gtk offers buffers and views on buffers. There can be more than one view on one buffer. In each buffer, one can define "tags", and associate parts of the text in a buffer to these tags. These tags can have different style which allows to render the (parts of) text in different colors, font weight, ... depending on the associated tags. This is for Gtk. What gtksourceview brings is a convenient way to define syntax elements and new buffers and views, inheriting from the original ones of gtk. The new buffers (source_buffers) can be given a language, which is a description of syntax elements. The buffers then automatically define tags corresponding to the syntax elements of the language and associates these tags to the parts of the text in the buffer, according to the definition of the syntax elements (keywords, beginning and ending of blocks, ...). The application only has to define the styles of each of these tags to provide syntax highlighting. The styles associated to "syntax tags" can be used to define background and foreground colors, bold, italic, strikethrough, and underline attributes. So each application has to define (and eventually store) the attributes associated to each "syntax tags" for each language. I hope this explanation was useful (and quite clear). By the way, the lablgtksourceview library offers bindings to the gtksourceview library (and so the features above): http://helm.cs.unibo.it/software/lablgtksourceview/ This library is used in Chamo to provide syntax highlighting. -- Maxence Guesdon http://yquem.inria.fr/~guesdon/ http://devel.inria.fr/rocq/