Toggle comments (was: [TxMt] Chunked undo, Language, overall slowness)

Allan Odgaard allan at macromates.com
Mon Sep 5 13:57:27 UTC 2005


On 05/09/2005, at 13.44, Steve Weintraub wrote:

> Fair enough, but first impressions count for a lot, so I think you  
> want to be careful about *what* you make work first, at the cost of  
> performance :)

Ah, I'm past the point in my life where I care about other peoples  
impressions :)

> In my first post in this thread I asked about command behaviors  
> being tied to languages, not filenames. Could you let me know if my  
> analysis here is accurate, or I'm missing something that would make  
> this work?

I'd suggest reading http://macromates.com/blog/archives/2005/07/06/ 
introduction-to-scopes/

As for comments, the Toggle Comment command in the Source bundle uses  
two variables (TM_COMMENT_START/END), these variables are set for  
misc. scopes (in the bundle editor), so even in an HTML file, it will  
use proper comment markers in the misc. <style>…</style>, <script>…</ 
script>, <?php … ?>, <% # ruby %> etc. blocks -- and in plain HTML,  
it'll also work.

This however require that you have the language set to HTML (and not  
PHP, which would make the scope of the entire file source.php).





More information about the textmate mailing list