[Geany] {filename} and New with Template (Re: Template for C++ headers)

Enrico Tröger enrico.troeger at xxxxx
Fri Nov 21 14:51:02 UTC 2008


On Thu, 20 Nov 2008 18:41:23 +0000, Nick Treleaven
<nick.treleaven at btinternet.com> wrote:

>> 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?%.

It depends how urgent is the case someone really wants "{filename}" not
to be replaced. Furthermore, all templates are editable and each
{filename} occurrence (or whatever wildcard) can be removed.
 I personally find using something like %?filename?% much more annoying
and it would break any existing user-modified templates.

The last resort would be to make the wildcards configurable. But this I
really don't want to have in the core, this should be done in a plugin.


>> 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.

I didn't mean to use a plugin for special C/C++ header stuff. Either we
move most things of the template code into a plugin so that using such
a plugin is more reasonable.
Or we just add {BASENAME} as a template. This could work as long until
someone else requests another fancy template feature.


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/users/attachments/20081121/732f09e7/attachment.pgp>


More information about the Users mailing list