[Geany-devel] Changes to templates

Colomban Wendling lists.ban at xxxxx
Tue Mar 15 21:10:55 UTC 2011


Le 15/03/2011 21:08, Matthew Brush a écrit :
> On 03/15/11 09:54, Colomban Wendling wrote:
>> Le 15/03/2011 04:12, Matthew Brush a écrit :
>>> Strip all leading and trailing whitespace on the text read from template
>>> files.
>>
>> What if somebody *wants* whitepaces/newlines at the end of her template?
>> I can easily imagine one wants this, for example for function
>> descriptions [1] or whatever (it's seems to be the case with the Geany's
>> default function template).
>> Moreover, Geany's default templates seems to work OK without the patch,
>> don't they?
> 
> I noticed Geany's default templates end with 2 trailing newlines,
> perhaps that should be changed to 1 to sort of "split the difference"? 

Not sure I understand what you mean, sorry :/ Could you rephrase please?

>>> Fix filetypes.c to use /* */ style comments rather than C++ style
>>> comments.
>>
>> I'd personally agree with this change, but it has a drawback: multi-line
>> C comments can't be nested. So the comment/un-comment command becomes a
>> little less useful since it'd break if commenting stuff including
>> comments.
> 
> This is true, and I didn't think of this, however, I still don't agree
> that for C filetype to insert "invalid" C code (by default).

C++-style single-line comments are not invalid in C. They are invalid in
ANSI C89 and ISO C90 (it's almost the same anyway), but totally valid in
ISO C99, and supported by most compilers (when not in strict C89/C90
conformance mode, of course).

>> Maybe a better fix would be to allow a filetype to define both
>> single-line and multi-line comments, and use them when appropriate?
>> (e.g. multi-lines comment for template comments, single-lines for ^E)
> 
> Another way would be to let users embed the comments directly into the
> templates, and not have it done automatically by software, letting the
> user choose the indentation and comment style for those.

I see 3 major problems at first glance:
1) comments are different in different languages (e.g. C and Python),
would then need a template per language (please, no);
2) how would we nest templates without nesting comments? (e.g.
fileheader includes gpl)
3) backward compatibility would most probably be lost.


Cheers,
Colomban



More information about the Devel mailing list