<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><B><I>Howdy.</I></B></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The whole porpoise behind the javascript bundles is to add better code folding and nested bracket scopes.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I use the <I>JavaScript bracketed proto</I> language which calls my modified version of the Prototype language (<I style="font-size: 10px; ">Prototype and Scriptaculous Mod</I>) which calls the Javascript language.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-style-span">The practical upshot of all that is that I can give each level of a nest of brackets a slightly darker background color (<FONT class="Apple-style-span" color="#000000" size="2"><SPAN class="Apple-style-span" style="background-color: transparent; font-size: 10px;">As seen in the javascript section of the screecast using the iLife 05 2 theme</SPAN></FONT>) and I can keep the curly brackets on the same line as the function or whatever and still be able to fold the section.</SPAN></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Using the Prototype JS language from encytemedia adds some nice scopes to prototype specific words. Also, the MochiKit (js) language does the same thing for MochiKit DOM function names and I have the MochiKit HELP command to look up their functions in a TextMate HTML window from the API description.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><B>The normal JS language uses:</B></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">foldingStartMarker = '^.*\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$';</SPAN></FONT></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">foldingStopMarker = '^\s*\}';</SPAN></FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><B>My version uses:</B></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#000000" face="Monaco" size="2"><SPAN class="Apple-style-span" style="background-color: transparent; font-size: 10px;">foldingStartMarker = '(^.*{[^}]*$|^.*\([^\)]*$|^.*/\*(?!.*\*/).*$)';</SPAN></FONT></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#000000" face="Monaco" size="2"><SPAN class="Apple-style-span" style="background-color: transparent; font-size: 10px;">foldingStopMarker = '(^\s*\}|^\s*\)|^(?!.*/\*).*\*/)';</SPAN></FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-style-span">You can really see the difference on files like the<I> </I><I>MochiKit 1.2 : PACKED VERSION</I> where nothing is tabbed properly, because of being compressed. Personally, I find having the opening curly bracket on the next line after the function to be truly horrible and unreadable, but that's just me. ;)</SPAN></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The slightly darker nested brackets are surprisingly addictive. I did it once, just to see what it would look like & if I could even do it, but now I just can't work in any deeply nested language without it. I used to have to think hard and pay attention to what level of the nest i'm in, but now I never don't know. The normal balance command is also totally invaluable (<SPAN class="Apple-style-span" style="font-size: 10px; ">if only it worked on nested html/xml tags, too</SPAN>).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>It's not uncommon to see scopes like "<SPAN class="Apple-style-span" style="font-size: 9px; ">source.js.bracketed.prototype meta.round-brackets.round meta.round-brackets.curly meta.round-brackets.curly meta.round-brackets.curly meta.round-brackets.curly meta.round-brackets.curly meta.round-brackets.round</SPAN>" using my version where the official js version just lists it as "<SPAN class="Apple-style-span" style="font-size: 9px; ">source.js</SPAN>".</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-style-span">I know I should totally change the scope name from meta.round-brackets.round & …curly. But i'd have to change every bundle that uses it and every theme that uses it and I just haven't gotten around (<FONT class="Apple-style-span" color="#000000" size="2"><SPAN class="Apple-style-span" style="background-color: transparent; font-size: 10px;">or curly ;) </SPAN></FONT>) to doing it yet.</SPAN></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Anybody have any suggestions on how I should name that? Should it even start with 'meta'?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Now that I have all this, I secretly wish more languages used curly brackets.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-style-span"><B style="font-size: 14px; ">Thanks.</B> (boy did I honk on for a while, huh)</SPAN></DIV><DIV style="font-size: 8px; "><I>PS: Yes, porpoise != purpose, that was merely for comedic effect. ;)</I></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I've been trying to adapt the nested scopes thing to ruby's do…end, if…end, etc… But then I lose the scope for the words themselves.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR><DIV><DIV>On Feb 6, 2006, at 4:55 AM, Andreas Wahlin wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV>It would also be nice with some explanations for your JavaScript bundles and so on on that page :)</DIV><DIV>And I also like the x51-something bundle a lot!</DIV><DIV><BR></DIV><DIV>Andreas</DIV></BLOCKQUOTE></DIV></BODY></HTML>