GNU bug report logs - #23387
25.0.93; Unicode quote inserted in Python mode outside of strings

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Wed, 27 Apr 2016 14:16:01 UTC

Severity: normal

Found in version 25.0.93

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 23387 <at> debbugs.gnu.org (full text, mbox):

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: 23387 <at> debbugs.gnu.org
Subject: Re: bug#23387: 25.0.93; Unicode quote inserted in Python mode outside
 of strings
Date: Thu, 28 Apr 2016 17:22:06 +0000
[Message part 1 (text/plain, inline)]
Philipp Stephani <p.stephani2 <at> gmail.com> schrieb am Do., 28. Apr. 2016 um
19:11 Uhr:

> Philipp Stephani <p.stephani2 <at> 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.
[Message part 2 (text/html, inline)]

This bug report was last modified 9 years and 19 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.