[TxMt] language mode is not per tab/file?
Allan Odgaard
throw-away-1 at macromates.com
Mon Nov 7 04:06:03 UTC 2005
On 06/11/2005, at 15.33, Xavier Noria wrote:
> Try this:
> 1. Open a file F1 with extension .pm, Perl mode is correctly
> active.
> 2. Open a second file F2 with extension .pm, Perl mode is
> correctly active.
> 3. Change F2's mode to C mode.
> 4. Switch back to F1's tab and you'll see it's now in C mode!
> Is that a bug?
Not really -- when switching language, TextMate learns that the
switched-to language should be used for the current extension. And
when switching buffer, it re-initializes language + settings. The
latter, one could argue, it does a little too often ATM (synch
settings) -- but TM is definitely not designed to have the same
extension mean two different languages, although it can be worked
around by having the grammar specify a “firstLineMatch”, like is done
for the .plist/.dict files, which can be both old-style ASCII and XML.
> [...] There's a file ending in .pm that is strictly a Perl module,
> but that actually is mostly C except for a few lines, since it uses
> Inline::C. I need C mode there to work normally.
If this is official syntax, I can add a rule to the Perl language
grammar to support it.
More information about the textmate
mailing list