Third party cookies may be stored when visiting this site. Please see the cookie information.

Home Family Days Out Raspberry Pi & Electronics Blog

Stewart's Blog

Stewart Watkiss website to the world ...

(Children, computing, first aid and other ramblings ...)

jEdit – adding syntax highlighting for Processing

I’ve recently been learning the Processing programming language. This is a programming language created for artists which is also the basis for the programming language used to program the Arduino. Processing includes an IDE called the Processing Development Environment (PDE), but the editor is quite basic.

The IDE has an option to use an external editor. One of my preferred editors is jEdit due to it’s cross-platform support. Jedit has built-in support for over 170 languages, but not processing which I guess is still a little bit too niche at the moment.

Adding a new language is fairly easy – and I’ve cheated a little to make it very easy.
Processing has a similar syntax to Java (as it’s based on Java), so I’ve just copied the Java syntax highlighting file with the option to tweak if I want to change in future.

The syntax highlighting is defined within xml files in the modes directory.

On Linux this is usually /usr/share/jedit/modes
On Windows this is c:\Program Files\jEdit\modes

As I was just using the java one I copied java.xml to processing.xml

Then add an entry to the catalog file “catalog”
Load the catalog file (eg. /usr/share/jedit/modes/catalog) into your favourite text editor [that’ll be jEdit then] and add the following entry at an appropriate point; the file is in alphabetical order, although I don’t think the actual position matters it makes it easier to find.

<MODE NAME="processing"		FILE="processing.xml"
				FILE_NAME_GLOB="*.pde" />

The FILE_NAME_GLOB says to apply this rule to any files ending .pde (which is used by processing files) treat them as processing files and use the mode as described in processing.xml.

In my case this reloaded straight away, but if not then you can force a reload using
Utilities -> Troubleshooting -> Reload Edit Modes

In future it may be worth tweaking the processing.xml file to ensure any differences between Java and processing are highlighted properly, but the standard file appears to be working fine at the moment.

Official version

Since writing this I’ve found a “official” version on the processing.org site. Essentially it’s the same as mine, but with some further changes to the processing.xml file to improve the syntax highlighting. If you’ve already applied the changes specified above you can just copy the processing.xml file in place of the one suggested above.

3 Responses to “jEdit – adding syntax highlighting for Processing”

  1. Stewart Says:

    I’d originally copied and pasted the xml which did not work embedding in html. I’ve updated the code to use safe angle brackets.

  2. Stewart Says:

    One more thing – if you do switch to using jEdit for editing your processing files don’t forget to change your preferences in PDE (processing development environment) to state “use external editor”. I spent some time trying to work out why some changes to the code weren’t taking effect until I realised I was making some changes in the PDE and some in jEdit.

  3. Stewart Says:

    Since writing this I’ve found a “official” version on the processing.org site. Essentially it’s the same as mine, but with some further changes to tyhe processing.xml file to improve the syntax highlighting. If you’ve already applied the changes specified above you can just copy the processing.xml file in place of the one suggested above.


UK days out, children and holiday information is also available on the Days Out Diary web site
Linux, LPI and the Quiz / Test Program posts are also available on the Penguin Tutor website
First Aid Information, first aid games and first aid practice test / quiz entries are also available on the First Aid Quiz Web site