On Dec 22, 2006, at 1:48 PM, Charilaos Skiadas wrote:
For most changes you want to do, including the one described above, you should simply create a new language, and in its patterns add the rules you want and finish by adding a rule that does: include = 'text.tex.latex'. See http://macromates.com/textmate/manual/ language_grammars#language_grammars for details. But the reason I was asking you for what particular changes you want to do is that this method should allow most changes you might want, but perhaps not all of them. It is certainly the most forward compatible method.
Fine, thanks. So, I created a new language "LaTeX HF" which included
firstLineMatch = '^\documentclass(?!.*{beamer})'; fileTypes = ( 'tex' );
followed by my changes, and a rule include = 'text.tex.latex'. In terms of syntax coloring the LaTeX source, this method does all what I want it to. Cool. However, I have two related technical questions.
1. What are possible ways to make this file take precedence over the original LaTeX language file? So far, I have changed it manually in the language selection at the bottom of the editor window. Is there an automatic way? I guess that I could also remove the above to lines from the original LaTeX language file ... but if I am not mistaken, these changes would mean that future updates to the LaTeX file will be ignored. Is that correct?
2. Which brought up another question for me. Let's assume I made changes to one of the supplied language files. Is there a way to "revert" those changes so that the language file is *for sure* the original one (so that updates are not going to be ignored), without loosing other changes (new cammands etc.) to the associated bundle?
Thanks Holger