On Tue, 04 Nov 2008 15:24:05 +0200, jay jay.27182818@gmail.com wrote:
Hi Jay,
sorry for the late answer.
hi guys! i've recently switched to geany from cdt (eclipse plugin for c/c++). when you create a new header file in cdt it's default content is like below:
#ifndef SOMEHEADER_H_ #define SOMEHEADER_H_
#endif /*SOMEHEADER_H_*/
where SOMEHEADER is the name of the file. Can you tell me how can i make it in geany? I have created a template and put it into ~/.geany/templates but geany doesn't seem to see it even after restart. my template has this content:
#ifndef {filename} #define {filename}
#endif /*{filename}*/
but filename is not what i need. I got stuck at this point. Need your help.
Unfortunately, most of the wildcards (to be more specific: all except {fileheader}) are not replaced for custom file templates. I just changed this in the SVN version so that the other wildcards can be used, too. So, also {filename} will now be replaced.
But this still doesn't help you because when you create a new document from a fle template, Geany will name this document 'untitled.xxx' where xxx is the extension of the template file.
So, even if you would use something like
ifndef {filename} define {filename}
endif /*{filename}*/
would result in
#ifndef untitled.h #define untitled.h
#endif /*untitled.h*/
The problem is that you want to have the final filename in the document after you initially saved it to disk. But at this point Geany doesn't know anything anymore about the template.
I don't think we should do anything about this in Geany itself. But it should be possible and reasonable to do this for a plugin, maybe with some other useful additions to the template system. If anyone wants to work on this, feel free to do so and to ask for help.
Regards, Enrico