question
Submitted by Thursday, 19 April, 2007 - 14:11
on
I'm trying to add special coloring for #ifdef (etc.) in Python files. These constructions are not a part of standard Python, hence not included in the standard jEdit Python mode. That is, my intention is to use the built-in Python coloring for all the normal Python keywords etc., and to extend this by adding a different coloring for #ifdef etc.
I did the following: to my user's 'catalog' file (i.e. the one in c:\documents and settings\<username>\.jedit\modes) I added the following line:
<MODE NAME="python2" FILE="python.xml" FILE_NAME_GLOB="*.py" />
Then I created in that same directory a file python.xml, which leaving out the usual stuff has the following:
<RULES>
<IMPORT DELEGATE="python::MAIN"/>
<KEYWORDS>
<KEYWORD4>#ifdef</KEYWORD4>
</KEYWORDS>
</RULES>
(I tried to indent the above, but I'm not sure how to do that in this forum...) And of course I set a special color for KEYWORD4 in jEdit's Utilities | Global Options: Syntax Highlighting.
If I'm understanding the documentation in the jEdit Help, this is the recommended way to extend a built-in coloring.
But it doesn't work. That is, I don't get any special coloring for #ifdef, only the normal Python coloring.
I have ruled out a number of things that I could be doing wrong. Specifically, I get #ifdef colored appropriately (as KEYWORD4) if I leave out the <IMPORT DELEGATE> line--but then I of course don't get any of the normal Python coloring. I have also verified that there are no KEYWORD4 tags in the original (as-shipped) python.xml file.
So what am I doing wrong?
Mike Maxwell
I did the following: to my user's 'catalog' file (i.e. the one in c:\documents and settings\<username>\.jedit\modes) I added the following line:
<MODE NAME="python2" FILE="python.xml" FILE_NAME_GLOB="*.py" />
Then I created in that same directory a file python.xml, which leaving out the usual stuff has the following:
<RULES>
<IMPORT DELEGATE="python::MAIN"/>
<KEYWORDS>
<KEYWORD4>#ifdef</KEYWORD4>
</KEYWORDS>
</RULES>
(I tried to indent the above, but I'm not sure how to do that in this forum...) And of course I set a special color for KEYWORD4 in jEdit's Utilities | Global Options: Syntax Highlighting.
If I'm understanding the documentation in the jEdit Help, this is the recommended way to extend a built-in coloring.
But it doesn't work. That is, I don't get any special coloring for #ifdef, only the normal Python coloring.
I have ruled out a number of things that I could be doing wrong. Specifically, I get #ifdef colored appropriately (as KEYWORD4) if I leave out the <IMPORT DELEGATE> line--but then I of course don't get any of the normal Python coloring. I have also verified that there are no KEYWORD4 tags in the original (as-shipped) python.xml file.
So what am I doing wrong?
Mike Maxwell