Running GNU Emacs 22.2.1 on Ubuntu 9.04.
When editing python code in emacs, if a docstring contains an apostrophe, emacs highlights all following code as a comment, until another apostrophe is used. Really annoying!
In other words, if I have a docstring like this:
''' This docstring has an apostrophe ' '''
Then all following code is highlighted as a comment. Comments are highlighted as code.
I can escape the docstring to avoid this, like this:
''' This docstring has an escaped apostrophe \' '''
Then highlighting is fine, but then it looks funny and unnecessary to other devs on my team, and I get made fun of for using emacs since ” it can’t handle apostrophies”. 😉
So, anyone know how to make emacs behave better in this regard?
Thanks,
Josh
This appears to work correctly in GNU Emacs 23.2.1. If it’s not practical to upgrade, you might be able to copy
python.elout of the Emacs 23 source code, or perhaps just the relevant pieces of it (python-quote-syntax, python-font-lock-syntactic-keywords, and the code that uses the latter, I think – I’m not much of an Elisp hacker).Unfortunately savannah.gnu.org’s bzr browser isn’t working just now so I can’t point you directly at the code, you’ll have to download it. See http://www.gnu.org/software/emacs/