Sorry for the late reply.
On Wed, 12 Nov 2008 21:08:37 +0100 Enrico Tröger enrico.troeger@uvena.de wrote:
One idea: maybe when using New with Template and the template uses {filename}, Geany could flag this in a private document field, and not transform it until the file is saved. On saving, Geany could check if the 'replace_template_filename' field is set, and replace all instances of {filename} with the proper filename.
This still won't solve the problem of replacing {filename} with HEADERFILE_H. But maybe we could add another wildcard like {FILENAME} which will replace the filename with an uppercase variant.
Yes, it would need something like {BASENAME}_H.
Maybe we don't need an additional flag at all when we extend the existing code in replace_header_filename() (document.c) to work on the whole file, not only the first three lines.
The problem is to avoid false positives - having a flag when using new with template reduces the problem of unwanted replacements, at least when saving a file not created with a file template.
But I think there could be a wider issue with templates - e.g. what if someone wants a {filename} string to appear in their template file and not be replaced? Using any kind of escaping for all braces e.g. {} would be annoying. So maybe a solution is to make template markers more unusual, e.g. %?filename?%.
But I'd still like to have all this done in a plugin in some way. Either a new one or by extending the classbuilder plugin to be more flexible.
Well, as Lex said it would be strange to use a plugin for C/C++ header file templates and normal New with Template file templates for all other files.
Regards, Nick