2

I am using python-mode for syntax highlighting. Everything is fine except the highlighting of docstrings, which makes reading code in github repositories with complex docstrings very difficult to do. Here an example:

class DoubleQuotesDocString:
    """
    This is a doc string but inside double quotes " the highlinting breaks: in for type while " so this is a bug
    """

class SingleQuotesDocString:
    '''
    This is a doc string but inside single quotes ' the highlinting breaks: in for type while ' so this is a bug
'''

And the corresponding screenshot where you see that it is not properly highlighted:

bad-highlighting

Of course this is a simple example. A complex docstring full of such highlighting bugs is completely unreadable.

Is there a solution for this?

EDIT: funny, stackoverflow highlighting also has trouble with this.

Drew
  • 29,895
  • 7
  • 74
  • 104
blueFast
  • 41,341
  • 63
  • 198
  • 344
  • In my default emacs python-mode it works fine. I'm not an emacs pro but you can always try checking the python mode settings on Py → PyTools → Customize python mode. – Alex Jun 06 '13 at 09:48
  • Thanks Alex, but it is not related to the settings. I have just found out that I am using a very old version of python-mode.el (5.1.0). The current version (6.1.1) does not have this problem. – blueFast Jun 06 '13 at 09:49

2 Answers2

4

The solution was to swtich from python-mode.el version 5.1.0 to version 6.1.1.

blueFast
  • 41,341
  • 63
  • 198
  • 344
0

It does not seem to affect the default python-mode that comes bundled with Emacs.

Stefan
  • 27,908
  • 4
  • 53
  • 82
  • Sorry for necrobumping but looks like things changed over time. Emacs 27.0.50 is affected by this issue. – muffinmad Mar 13 '19 at 16:18
  • And now it's [fixed](http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5feaf906e110097a443af78f549f01c1bd527e25). Thank you. – muffinmad Mar 14 '19 at 11:47