[Geany-devel] Changes to templates

Matthew Brush mbrush at xxxxx
Fri Mar 18 23:55:25 UTC 2011


On 03/18/11 14:10, Colomban Wendling wrote:
> we got two new lines. I'm not saying it's OK, just that this is
> "logical" (read ahead).

I thought I had tested this exact scenario and it was still adding a 
newline, but like you said, it doesn't.

> As said, the code don't add new lines, though it's true the final result
> actually looks weird.
> What I propose is to strip the last "implicit" new line at the end of
> all the loaded template files if they have one. This would fix your
> issue (in an Unices world at least) IIUC.
>
> Do you (all) think it's OK to strip the last new line of the end of
> template files, since it's most likely to be an "implicit" new line?

Knowing that it comes from the file itself, I'd like to reverse my 
opinion on this and say to leave it up to the template.  What I think 
would be better, would be to modify the default license templates to not 
have any trailing newlines at all.  This way it's exactly like in the 
text file and if someone wants to change it, and still not have the 
trailing newline, all they have to do is turn off the automatic newline 
feature of Geany and remove the newlines before saving.

> No, even if I hardly know Java, I doubt nesting C-style comments is
> valid in Java. Not sure why it's the default in the Java filetype...
> does Java support C++-style comments?

AFAIK, all the languages where there is /* */ style comments in the 
filetypes.* files (except older versions of C) support C++ // style 
comments.  What's more, AFAIK none of them allow nesting /* */ style 
comments.  I'm not expert on any languages, let alone all these, but 
this seems to be the case.

My opinion is that all applicable filetypes.* files should use // except 
CSS since it neither supports // style comments, nor nested comments, 
there is no hope for him :)  I still don't think C should use // style 
comments for the reasons previously mentioned but I'll concede that it's 
more convenient in most cases and easy enough to change.

> I think that if you prefer /* */ comments it's not *this*
> hard to change your filetypes.c accordingly (although it's a bit a
> power-user thing, I agree).

I was being dramatic for effect :)

>>> 3) backward compatibility would most probably be lost.
>>
>> Not sure what you mean by this, but probably also good point :)
>
> I mean that if somebody wrote his own templates, they wouldn't work at
> all anymore (they'd miss the comment around); it'd not only be a few
> newlines at the start or the end that would have changed.

Ah, OK, that makes sense.

> Maybe take a look at GeanyGenDoc, it should be able to do the right
> thing (just need to teach it with the appropriate configuration file,
> not done yet) -- and if it isn't able, file a bug report ;)

I actually tried looking for this plugin in the Plugin Manager before 
posting about Python to see what it could do, but I couldn't find the 
plugin.  I'll have to see why it's not building.

Cheers,
Matthew Brush



More information about the Devel mailing list