[Geany-devel] question about templates

Enrico Tröger enrico.troeger at xxxxx
Sun Jul 5 16:47:09 UTC 2009


On Sun, 5 Jul 2009 17:52:14 +0200, Andreas wrote:

>> We should rewrite this function so that it uses the
>> comment_open/comment_close settings
>
>Definitely. Then you can choose yourself.
>
>> but there is still the lack for
>> the line_prefix information. 
>
>You mean tabs or spaces at the beginning of the lines?

No, the line_prefix means to insert an asterisk at the beginning of
lines inside the multi line comment, e.g.
/*
 * blah
 * blah
*/

line_prefix would be " *" in this case.


>> We could either add line_prefix to the
>> filetype definition files or magically guess it. But I don't like
>> both ways that much. Not sure what to do best.
>
>I'd prefer magically. There might be different line_prefixes depending
>on the place of the comment.

Well, I thought of something like:
if comment_close is set, then check the second char of comment_open and
use it as line_prefix. E.g.
comment_open=/*
comment_close=*/

second char of comment_open == *
so we have a line_prefix = * and this we prefix with some whitespace
and we get what we have currently hardcoded.
But this might fail for other comment types which are not so C-like.


>Another thing that would be nice to have is filling function name and
>params automagically function declarations :-)

Function name should be inserted into the template if it is known. I
just tested it with C and it works provided that the cursor is inside
the function definition so that Geany knows on what function it should
operate. This can be improved but doesn't necessarily need to.
About params: bah. Implement it if you need it, I don't think it's
necessary.

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090705/4c9f955e/attachment.pgp>


More information about the Devel mailing list