[Geany] infile filetype
Lex Trotman
elextr at xxxxx
Sat Apr 3 01:39:41 UTC 2010
On 3 April 2010 02:14, Christian Holland <mail at cholland.de> wrote:
> Hello,
> I search about a possibility to set the filetype in the file itself.
>
> E.g. a file is identified as shell script cause
> first line starts with '#!/bin/bash',
> but inside perl is called with -x.
> So the file should be formatted as perl script automatically at startup.
> I know, I can set the filetype within the menus,
> but I have to do this everytime the is loaded.
> With vim it is possible to do this automatically when the file is loaded
> with a line '# vim: set filetype=perl:'.
> For the encoding type, geany recognized a line with
> '# coding: ISO-8859-15' .
> I searched and tried with '# geany_filetype: perl' and
> '# filetype: perl', but the auto filetype is shell-script at startup.
>
> So, is there a possibility to set the filetype in the file itself ?
>
> Regards Chris.
>
>
Hi Chris,
Geany detects filetype by:
1. if the file starts with #! and one of the recognised command names (sh,
bash, perl, python etc.) then use that filetype
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
3. if the file starts <?xml then xml or <?php then php
4. if none of the above then a recognised extension sets the filetype else
none
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.
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.
Cheers
Lex
_______________________________________________
> Geany mailing list
> Geany at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/users/attachments/20100403/046f5dd8/attachment.html>
More information about the Users
mailing list