<br><br><div class="gmail_quote">On 3 April 2010 02:14, Christian Holland <span dir="ltr"><<a href="mailto:mail@cholland.de">mail@cholland.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">






<div text="#000000" bgcolor="#ffffff">
Hello,<br>
I search about a possibility to set the filetype in the file itself.<br>
<br>
E.g. a file is identified as shell script cause <br>
first line starts with '#!/bin/<big>bash</big>',<br>
but inside perl is called with -x.<br>
So the file should be formatted as perl script automatically at startup.<br>
I know, I can set the filetype within the menus,<br>
but I have to do this everytime the is loaded.<br>
With vim it is possible to do this automatically when the file is loaded<br>
with a line '# vim: set filetype=perl:'.<br>
For the encoding type, geany recognized a line with<br>
'# coding: ISO-8859-15' . <br>
I searched and tried with '# geany_filetype: perl' and<br>
'# filetype: perl', but the auto filetype is shell-script at startup. <br>
<br>
So, is there a possibility to set the filetype in the file itself ?<br>
<br>
Regards Chris.<br>
</div>

<br></blockquote><div><br>Hi Chris,<br><br>Geany detects filetype by:<br><br>1. if the file starts with #! and one of the recognised command names (sh, bash, perl, python etc.) then use that filetype<br>2. if the file starts with <! DOCTYPE html or <html uses html unless the file extension is one of the perl, php or python extensions when it uses that instead<br>
3. if the file starts <?xml then xml or <?php then php<br>4. if none of the above then a recognised extension sets the filetype else none<br><br>There has been discussion about recognising Emacs and/or vim filetype marks but shtdi and no one has needed it that bad to be motivated, but patches welcome.<br>
<br>In your case there are two filetypes so it would depend on the order the tests were done which it would use, I guess if Emacs or vim mark is present then that overrides the others even though the bash mark would precede the emacs/vim mark.<br>
<br>Cheers<br>Lex<br><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>
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>