[Geany-devel] Changes to templates

Colomban Wendling lists.ban at xxxxx
Fri Mar 18 23:26:33 UTC 2011

Le 18/03/2011 23:52, Lex Trotman a écrit :
> Hi Colomban,
> [..]
>> 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?
>> Attached the possible patch, if you like to test it before.
> I think its ok to strip only one newline, then people who actually do
> want extra blank lines in their templates can still have them, they
> just have to remember one gets stripped.

Yep, and the idea of stripping one being that most editors add it
implicitly, at least on Unices.

> Only comment on the patch is that you have swapped the order of
> frame_end and template_eol_char at the end of the template. (compare
> lines 21 and 67/68 of the patch)

It was indented actually (not as swapping though):
* I added a line before the frame_end since the template no longer have
a trailing new line.
* I removed the newline after because it added implicitly an extra
newline in e.g. template files (main.c, etc.) after the comment, but
maybe we better keep it (e.g. inserting a template comment adds a new
line); not sure.

>> Too bad C don't have D's /+ +/ comments ;(
>> But in the meantime (hopefully :D), I still think that it's important to
>> keep nestable comments by default for ^E (maybe because I use ^E to
>> temporarily comment stuff out and rarely to create "true" comments).
>> And moreover, 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'm not sure we should consider changing a config file too power-user,
> after all the assumption is that *all* users are programmers of some
> type.

True. Anyway, it'd be good to have both (single and multi-line comment).

>>> The other thing I notice, since we're discussing it; shouldn't the
>>> Python "Function Description" insert a triple-quoted docstrings below
>>> the function def, not hash (#) comments above the def?  I don't think
>>> the hash-style comments would be understood by Doxygen, Epydoc, or
>>> Sphynx, for example, but I might be wrong.  I'm pretty sure it won't end
>>> up in the __doc__ attribute of the function though.
>> This may be fixed by supporting two comment types per filetype, one
>> single-line (or at least nestable) to use with ^E, and one for
>> multi-line comments. Though, it wouldn't probably be enough for Python
>> since you still want to use sharp-comments in e.g. fileheader but
>> triple-quote-strings as comments for doc...
> Yes we need a separate template_comment_open and
> template_comment_close in filetypes.*.

This wouldn't solve the problem since in Python you don't want all
template to use """ ... """

>  After some consideration I think that docstrings are not comments so
> they should not be inserted by "insert comments".

Maybe. Not sure the distinction is really needed though.


More information about the Devel mailing list