I write a LOT of LaTeX documents, and as I was working on the class for one of them, I've noticed that when trying to fix up some braces ({}), TextMate will slam the CPU on my iMac G5 to 100% for 15-20 seconds, before continuing. Here's a little snip from what I was trying to fix:
\newcommand{\tla}[1]{{\scshape {\MakeLowercase{#1}}}}
Not very complex, but when I added the last closing brace, it went wonky. I had thought in the past that it wouldn't come out, so I'd kill it, but this time, I just let it run, and eventually it fixed itself.
I tried switching to plain text, and that helped, so it seems to be something in the way the language pack is written. Any thoughts?
Chris
On Jun 13, 2005, at 12:44 PM, Christopher Petrilli wrote:
I write a LOT of LaTeX documents, and as I was working on the class for one of them, I've noticed that when trying to fix up some braces ({}), TextMate will slam the CPU on my iMac G5 to 100% for 15-20 seconds, before continuing. Here's a little snip from what I was trying to fix:
\newcommand{\tla}[1]{{\scshape {\MakeLowercase{#1}}}}
Not very complex, but when I added the last closing brace, it went wonky. I had thought in the past that it wouldn't come out, so I'd kill it, but this time, I just let it run, and eventually it fixed itself.
The above line by itself is not a problem, so, if you could send us the entire file, I'll try to have a look at it. How big is the document? Are the lines very long? Have you checked out the latest revision? I find it slow at times too, but it's hard to pin down. To begin with, lines like the above are not colored properly anyway, and that's not too easy to fix at the time. I would recommend, as a possibly temporary solution, to move all your newcommands and other preamble instructions to another file, say begin.tex, and then use \input{begin.tex}. If you tend to reuse your commands, this will be very handy in the long run anyway, and it might make things faster.
I tried switching to plain text, and that helped, so it seems to be something in the way the language pack is written. Any thoughts?
Chris
| Christopher Petrilli | petrilli@gmail.com
Haris
On 6/13/05, Charilaos Skiadas skiadas@math.uchicago.edu wrote:
The above line by itself is not a problem, so, if you could send us the entire file, I'll try to have a look at it.
Unfortunately, I can't, but the file is only 206 lines, as it is a .sty file that modifies the memoir package. Nothing complex.
How big is the document? Are the lines very long? Have you checked out the latest revision?
206 lines, nope, all under 80 characters, and yes.
The funny thing is that TeXshop colors it correctly, so it might be worth looking at what they do.
Chris
On Jun 13, 2005, at 3:14 PM, Christopher Petrilli wrote:
On 6/13/05, Charilaos Skiadas skiadas@math.uchicago.edu wrote:
The above line by itself is not a problem, so, if you could send us the entire file, I'll try to have a look at it.
Unfortunately, I can't, but the file is only 206 lines, as it is a .sty file that modifies the memoir package. Nothing complex.
I am not really familiar with the syntax for sty files. Is it exactly the same as the latex syntax, or is anything different? Can you maybe create a small sample demonstrating the problem? I just tried opening pdfsync.sty and adding the line you mentioned at a couple random locations, but it worked fine, so there is something else in the context that causes trouble.
How big is the document? Are the lines very long? Have you checked out the latest revision?
206 lines, nope, all under 80 characters, and yes.
The funny thing is that TeXshop colors it correctly, so it might be worth looking at what they do.
Unfortunately recursion is not perfect in TextMate yet, so there are some things that are hard to implement perfectly at this point, and nested commands, though partially supported, are not perfect at this point. This might be what is causing the problems in your case, or it might be irrelevant, but it seems that sty files tend to have lots of nested commands. I personally don't work with sty files, and I think the same is true of the others maintaining the latex bundle, so the patterns for commands might not be ideal at this point for sty use. I'll take a look at the command matching pattern, but given that I didn't write it in the first place it's hard to see what the problem is without some test cases. So as I said above, if you can generate a small test case that shows exactly where the problem is, it would be very helpful.
Can you tell us the scope on each of the parts of the line you mentioned earlier, i.e. what the scopes of \newcommand, \tla, 1, \scshape, \MakeLowercase and #1 are, in your context?
Chris
Haris
On Jun 13, 2005, at 22:14, Christopher Petrilli wrote:
Unfortunately, I can't, but the file is only 206 lines, as it is a .sty file that modifies the memoir package. Nothing complex.
I'm almost certain that the slowdown is caused by the previous recursive regular expressions in the latex syntax. Are you using the language syntax included with 1.1b12 or did you check out a recent version from svn?
[...] The funny thing is that TeXshop colors it correctly, so it might be worth looking at what they do.
The fundamental difference probably is that TM has a declarative format which allow the user to define how languages should be parsed -- this though is still incomplete. If only I needed to parse one language, my task would have been a lot easier, but TM would also have been a lot less flexible ;)