jEdit Community - Resources for users of the jEdit Text Editor
Help! Can't get Python syntax highlighting to work
Submitted by kcstrom on Friday, 25 May, 2012 - 12:34
At work, others like to strip off the .py on some python files which wouldn't be a big deal, except they also have '#! python' instead of the more normal pattern of something like '#! /usr/bin/env python'. So I changed the /path/to/my/jedit/settings/catalog file to have a copy/paste of the python file mode from the /path/to/jedit/install/settings/modes/catalog file except I removed '*/' from the FIRST_LINE_GLOB so it would match both the normal and the less normal that is used at my work.

That was great - it now recognizes both file types as python. Unfortunately, I no longer have syntax highlighting for the Python edit mode. I've undone my changes, and updated from Python 4.5.0 to 4.5.1 just to make sure I hadn't modified the original catalog or did something else weird (I'm pretty sure I didn't anyway), but syntax highlighting for Python is still broken.

Please help!
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
trials
by Robert Schwenn on Fri, 25/05/2012 - 20:41
Are You saying, that jEdit correctly changes the current edit mode to python when You change from i.e. text file to a python file? But nevertheless syntax highlighting isn't done for python files but for other files it works well?

If 3 times yes, I'd see two points to check:
- Maybe Your python.xml edit mode file isn't correct (maybe invalid xml).
- Maybe Your personal settings are corrupt. Try to start after deleting or renaming Your settings directory.
 
Thanks!
by kcstrom on Tue, 29/05/2012 - 11:38
Thanks for the help Robert! When I renamed my .jedit directory, the highlighting started working. Through a process of elimination, I found it was the combination of the .jedit/modes directory and .jedit/properties file. The properties file has a cache of "mode.python.firstlineGlob=\#\!*python*" in it as well as "mode.python.file=\\.jedit\\modes\\python.xml". I was expecting it to fall back to the installed version of python.xml, but it apparantly doesn't as I copied that from the installation directory into my .jedit/modes directory and it works now.

Thanks again.
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293