|
From: | Philipp Stephani |
Subject: | bug#23387: 25.0.93; Unicode quote inserted in Python mode outside of strings |
Date: | Sat, 30 Apr 2016 11:59:16 +0000 |
Philipp Stephani <p.stephani2@gmail.com> schrieb am Do., 28. Apr. 2016 um 19:11 Uhr:Philipp Stephani <p.stephani2@gmail.com> 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.
0001-Fix-insertion-of-Unicode-quotes-in-strings.patch
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |