[TxMt] language mode is not per tab/file?

Greg Humphreys humper at gmail.com
Sun Nov 6 17:29:09 UTC 2005


Along those lines, I have a feature request which I would use  
frequently, which is that a single file could be multi-mode based on  
some very simple regular expression matching.

For example, I have lots of files that look like this:

LaTeX stuff
LaTeX stuff
LaTeX stuff

<<some string>>=
C++ stuff
C++ stuff
C++ stuff
@

LaTeX stuff
LaTeX stuff
LaTeX stuff

<<some other string>>=
C++ stuff
C++ stuff
C++ stuff
@

and so on.  I'd like the sections to be syntax highlighted (hilit?)  
according to their respective styles, and when the cursor is between  
the <<...>>= and @, I'd like to edit in C++ mode with all the  
associated macros / tab expanders, and in LaTeX otherwise.

I'm mainly just a user of TextMate; I haven't really extended it in  
any meaningful way; is this something that an experienced end-user  
could do, or would it require a fundamental change to the core?

Allan?  Thoughts about this?  I imagine it would be implemented as a  
"meta-mode", which is just a mode that tells TM under what  
circumstances it should interpret blocks as other modes.

--
Greg Humphreys, Assistant Professor
Department of Computer Science, University of Virginia
http://www.cs.virginia.edu/~humper/




On Nov 6, 2005, at 9:33 AM, 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?
>
> -- fxn
>
> Just in case you are wondering where does this convoluted  
> experiment comes from: I am working in a Perl module that has some  
> part written in C:
>
>     http://search.cpan.org/~fxn/Algorithm-Combinatorics/
>
> 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.
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>
>





More information about the textmate mailing list