[TxMt] Filename Extensions
sking at arbor.net
Fri Apr 25 13:26:40 UTC 2008
Allan Odgaard wrote:
> There is nothing there to indicate, that the file is what you refer to
> as binary. TextMate uses a heuristic where it scans the first 4 KB or
> similar, and if it looks like text, it is treated as text. But if you
> do not use extensions, you can’t expect programs to figure out what
> the type of the file is.
I'm not asking the application to determine it, just a way to manually
tell the app "this particular file is binary". As opposed to "all files
with this extension are binary".
(Although I should note that whatever heuristic Perl uses to determine
whether a file is text or binary seems to work in the huge majority of
cases, so it's at least possible for the app to make an educated guess.)
> You can however use double-extensions, like ‘file.real-type.txt’ and
> then update the language grammar of real-type to claim the
> ‘real-type.txt’ extension.
Alas, I can't go back and change years worth of file names. Again, this
is where I'd like a feature to say "this PARTICULAR file is
such-and-such" without saying "any file with this extension is
such-and-such". Or even a way to say "treat this particular file as a
different type for the duration of this session, but DON'T change the
type associated with the extension". I don't care if the temporary
association to an individual file is preserved across sessions.
> The grammars have a ‘firstLineMatch’ regexp to look for shebang and
Ah, I didn't know that! Is that a new behavior, or just something I've
missed seeing? Is there any way to extend it to a multiline match so it
could find something like an emacs modeline or vim config line elsewhere
in the file? (The vim guys like to put it at the end of the file.)
Sr. Software Engineer
+1 734 821 1461
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the textmate