[Geany-devel] Deep editor customization....

Jimmy Paillet jimmy.paillet at xxxxx
Fri May 8 18:59:15 UTC 2009

Hi again,
ok, just for fun, here's a patch to a basic functional version...(and the
modified files in case patch is not working acording to plans...)
it's tiny modifications to src/highlighting.c and src/highlighting.h :D

once the patch applied you should be able to add to styling sections of
a font name, and a font size...
in that fashion:

I've attached a filetype example to see how to use...
if you leave it the way it is...then you just get the usual highlighting...

I've only tested it with Python and C....

as mentionned earlier, if you change the default font during a session, it
will break the custom styling for the duration of the session....
i'll work on that...

later on I'll provide extra options to change margin sizes, markers and

let me know if it works


2009/5/8 Jimmy Paillet <jimmy.paillet at gmail.com>

> nevermind...just used a strcpy...went just fine...
> i'll probably make decent advances now...
> cheers
> j
> 2009/5/8 Jimmy Paillet <jimmy.paillet at gmail.com>
> Hi,
>> I think i can express it clearly now....
>> this my GeanyLexerStyle:
>> typedef struct GeanyLexerStyle
>> {
>>     gint    foreground;    /**< Foreground text colour, in @c 0xBBGGRR
>> format. */
>>     gint    background;    /**< Background text colour, in @c 0xBBGGRR
>> format. */
>>     gboolean bold;        /**< Bold. */
>>     gboolean italic;    /**< Italic. */
>>     gchar* font_perso;    /**  A font name*/
>>     gint font_size;
>> }
>> GeanyLexerStyle;
>> in get_keyfile_style, this struct is filled (as least for c)...
>> thanks to a gchar** list... pointing to the [styling] sections of
>> filetypes.foo
>> of course at the end of this function, list is free'd....so my pointer
>> font_perso points to crap outside the func...hence my pb... :D
>> when I comment out the free statement, thinhs behave logically...
>> what do you reckon? free the list variable later on?
>> jimmy
>> 2009/5/8 Enrico Tröger <enrico.troeger at uvena.de>
>>> On Fri, 8 May 2009 18:26:15 +0200, Jimmy wrote:
>>> >> >functions...i'm facing pointer pbs, basically...my font name does
>>> >> >not propagate properly through functions...
>>> >>
>>> >> If you need help for a specific problem, just ask.
>>> >
>>> >
>>> >ok...it's probably silly, as i'm not an experienced C programmer...and
>>> >didn't spend a lot of time on it...
>>> >but as I told you, I expanded the GeanyLexerStyle structure....
>>> >
>>> >in get_keyfile_style and get_key_file_hex my adds to the filetypes.foo
>>> >are properly read...
>>> >and when i print out my new element of the struct it's either null or
>>> >the fontname I've just entered in the file....
>>> >
>>> >but when i try to access my new entry in a another function (such as
>>> >set_sci_style), it has been obviously been written over by something
>>> Hard to say without any code but it sounds like the char* pointer is
>>> either freed in between or it's a static string which is only valid
>>> within a function. Just create a diff of your current code and send it
>>> to the list or me or some paste bin or whatever.
>>> Regards,
>>> Enrico
>>> --
>>> Get my GPG key from http://www.uvena.de/pub.asc
>>> _______________________________________________
>>> Geany-devel mailing list
>>> Geany-devel at uvena.de
>>> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20090508/63dbac72/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: small.patch
Type: text/x-patch
Size: 2490 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090508/63dbac72/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: highlighting.c
Type: text/x-csrc
Size: 214752 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090508/63dbac72/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: highlighting.h
Type: text/x-chdr
Size: 2053 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090508/63dbac72/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filetypes.c
Type: text/x-csrc
Size: 2907 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090508/63dbac72/attachment-0001.c>

More information about the Devel mailing list