The Reevoo office is all-Mac, with the exception of one bargain-basement Windows XP box used for billing and debugging our website in Internet Explorer (to which, as regular readers will know, I bear an intense and righteous anger, but that’s not what I want to talk about today). We developers use TextMate as an editor. It’s a decent product with some well-thought-out features that really increase productivity, but it’s also hopelessly immature in many ways. In general, although I miss vim key mappings, I’m happy using TextMate for daily work.

Until recently, TextMate’s ‘Find in Project’ feature was really broken: its memory requirements when searching a large directory were so unreasonably huge that it would paralyse the operating system in half an hour of memory swapping ended only by the eventual death of the TextMate process. (In my estimation, Mac OS X’s memory management is also more than a little suspect.)

This sorry state of affairs would most frequently be triggered by attempting to search a large log directory in a Rails project. Given that running tests writes a lot to the logs, and we do a lot of testing, this was the rule rather than the exception. I had to learn not to use ‘Find in Project’ without first deleting everything in the log directory first. Sometimes I’d forget and get a very long enforced tea break. Whilst I enjoy breaks and recognise their health benefits, I prefer to take them on my own schedule—waiting for an unresponsive computer is anything but restful.

I’m happy to say that the rampant memory use has been fixed by a recent update to TextMate. Nonetheless, having to search the log directories makes searches much slower than they need be and tends to clutter the results. Ideally, I’d just like it to skip them entirely. Today, after five months of daily use, I finally worked out how.

Surely I can’t be the only one to have suffered this problem! I don’t think it’s just me being entirely daft: it’s genuinely difficult to find. Hidden in the Preferences dialog, behind the ‘Advanced’ section and in a tab named ‘Folder References, there is an input box labelled ‘Folder Pattern’. The name doesn’t really explain its function, but closer inspection reveals that it contains a regular expression telling TextMate which directories (or ‘Folders’ in Mac OS X parlance) it should ignore when loading a project.

TextMate Preferences screenshot

By default, it contains patterns for the data directories of a variety of version control systems. If we add log to these, it’ll ignore log directories too:

!.*/(.[^/]*|log|CVS|_darcs|{arch}|blib …

Next time we load a Rails project into TextMate the log directory simply won’t appear, and won’t be included in searches. Of course, if you actually wanted to look at the logs in TextMate, you’re out of luck—but then again, it can’t handle large text files anyway. Like I said earlier, it’s still an immature application.