From: Philipp Stephani <p.stephani2@gmail.com>
To: 23387@debbugs.gnu.org
Subject: bug#23387: 25.0.93; Unicode quote inserted in Python mode outside of strings
Date: Thu, 28 Apr 2016 17:22:06 +0000 [thread overview]
Message-ID: <CAArVCkSn+gAk+iPJMRLp=Q+QGx8bGBov_hbTRMvfmhRQr8HgjA@mail.gmail.com> (raw)
In-Reply-To: <CAArVCkQVSrhuVuW1a75u-D0bY8oyM3wOcDit1oRYXsjFR+oWBg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1022 bytes --]
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.
[-- Attachment #2: Type: text/html, Size: 1619 bytes --]
next prev parent reply other threads:[~2016-04-28 17:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-27 14:14 bug#23387: 25.0.93; Unicode quote inserted in Python mode outside of strings Philipp Stephani
2016-04-28 17:11 ` Philipp Stephani
2016-04-28 17:22 ` Philipp Stephani [this message]
2016-04-30 11:59 ` Philipp Stephani
2016-05-02 16:04 ` Paul Eggert
2016-05-03 20:44 ` Philipp Stephani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAArVCkSn+gAk+iPJMRLp=Q+QGx8bGBov_hbTRMvfmhRQr8HgjA@mail.gmail.com' \
--to=p.stephani2@gmail.com \
--cc=23387@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.