Thursday, July 12, 2007

SEEing LaTeX 7: A Brief Digression to Build Tools

There are starting to be enough scripts for the LaTeX mode (some not yet described!) to justify automating the construction and installation of the mode. My first thought was make, unsurprisingly. There is a Makefile mode on the Coding Monkeys site, but it turned out to be a little disappointing.

Not that it was bad, per se, just that it could be more. The existing mode highlights the syntax, and that's about it. It doesn't even automatically set the mode if you open a file named "Makefile"; you have to do that by hand.

It wasn't very hard to extend the mode a bit. I added a ModeSettings.xml file to the bundle, specifying that files named "Makefile", "makefile", and "GNUmakefile" should be associated with the mode. The scripts for the LaTeX mode were easy to adapt into a form that would run make on the current SubEthaEdit document. It was necessary to add a little to the AppleScript portion, so that the results of running make would be reported, but that was straightforward.

Unlike earlier installments in this series, I'm not going to present any of the scripts here. I see nothing more to do with the Makefiles mode, so I sent it to the Coding Monkeys. Once it's available on their site, anyone interested can download the mode and examine the scripts.

No comments: