bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23387: 25.0.93; Unicode quote inserted in Python mode outside of str


From: Philipp Stephani
Subject: bug#23387: 25.0.93; Unicode quote inserted in Python mode outside of strings
Date: Thu, 28 Apr 2016 17:22:06 +0000



Philipp Stephani <address@hidden> schrieb am Do., 28. Apr. 2016 um 19:11 Uhr:
Philipp Stephani <address@hidden> schrieb am Mi., 27. Apr. 2016 um 16:16 Uhr:

emacs -Q
M-x electric-quote-mode
M-x customize-variable RET electric-quote-string, set it to t, save
M-x python-mode
Hit '

Expected: ' (ASCII apostrophe) is inserted because point is outside a string
Actual: ’ (Unicode quote) is inserted

This seems to happen only in Python mode, not in e.g. emacs-lisp-mode.

Also happens in C++ mode, and probably others. 

The root cause is that electric-quote-post-self-insert-function uses syntax-ppss to check whether point is in a string or comment. Before it makes any replacement, the ASCII apostrophe is still in the buffer, so syntax-ppss considers point to be inside a string. It looks like calling syntax-ppss with (forward-point -1) as argument instead of (point) should fix it, but I'm not sure whether that's the right way.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]