<br><br><div class="gmail_quote">2008/11/11 Enrico Tröger <span dir="ltr"><<a href="mailto:enrico.troeger@uvena.de">enrico.troeger@uvena.de</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, 04 Nov 2008 15:24:05 +0200, jay <<a href="mailto:jay.27182818@gmail.com">jay.27182818@gmail.com</a>> wrote:<br>
<br>
Hi Jay,<br>
<br>
sorry for the late answer.<br>
<div class="Ih2E3d"><br>
<br>
>hi guys! i've recently switched to geany from cdt (eclipse plugin for<br>
>c/c++). when you create a new header file in cdt it's default content<br>
>is like below:<br>
><br>
>#ifndef SOMEHEADER_H_<br>
>#define SOMEHEADER_H_<br>
><br>
>#endif /*SOMEHEADER_H_*/<br>
><br>
>where SOMEHEADER is the name of the file. Can you tell me how can i<br>
>make it in geany? I have created a template and put it into<br>
>~/.geany/templates but geany doesn't seem to see it even after restart.<br>
>my template has this content:<br>
><br>
>#ifndef {filename}<br>
>#define {filename}<br>
><br>
>#endif /*{filename}*/<br>
><br>
>but filename is not what i need. I got stuck at this point. Need your<br>
>help.<br>
<br>
</div>Unfortunately, most of the wildcards (to be more specific: all except<br>
{fileheader}) are not replaced for custom file templates.<br>
I just changed this in the SVN version so that the other wildcards can<br>
be used, too. So, also {filename} will now be replaced.<br>
<br>
But this still doesn't help you because when you create a new document<br>
from a fle template, Geany will name this document 'untitled.xxx' where<br>
xxx is the extension of the template file.<br>
<br>
So, even if you would use something like<br>
<div class="Ih2E3d"><br>
ifndef {filename}<br>
define {filename}<br>
<br>
endif /*{filename}*/<br>
<br>
</div>would result in<br>
<br>
#ifndef untitled.h<br>
#define untitled.h<br>
<br>
#endif /*untitled.h*/<br>
<br>
<br>
The problem is that you want to have the final filename in the document<br>
after you initially saved it to disk. But at this point Geany doesn't<br>
know anything anymore about the template.</blockquote><div> </div><div>Perhaps in the meantime Jay could use a snippet and insert it after saving the file.<br>e.g.defining in section [C] in your snippets.conf<br>hguard=#ifndef HAVE_{filename}\n#define HAVE_{filename}\n\n#endif<br>
<br>This still requires editing the result as it will contain a dot (.h) which isn't <br>allowed in identifiers but it is part way there.  Perhaps adding an extra substitute<br>thats equivalent of %e in the make commands would be an easy fix?<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I don't think we should do anything about this in Geany itself.<br>
But it should be possible and reasonable to do this for a plugin, maybe<br>
with some other useful additions to the template system.<br>
If anyone wants to work on this, feel free to do so and to ask for help.<br>
<br>
Regards,<br>
Enrico<br>
<font color="#888888"><br>
--<br>
Get my GPG key from <a href="http://www.uvena.de/pub.asc" target="_blank">http://www.uvena.de/pub.asc</a><br>
</font><br>_______________________________________________<br>
Geany mailing list<br>
<a href="mailto:Geany@uvena.de">Geany@uvena.de</a><br>
<a href="http://lists.uvena.de/cgi-bin/mailman/listinfo/geany" target="_blank">http://lists.uvena.de/cgi-bin/mailman/listinfo/geany</a><br>
<br></blockquote></div><br>