From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#29812: 27.0.50; electric-quote-replace-double misbehaves in Lisp strings Date: Sun, 31 Dec 2017 16:16:02 +0000 Message-ID: References: <837etenanf.fsf@gnu.org> <83efnaew0p.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114c563e3edfdd0561a52f80" X-Trace: blaine.gmane.org 1514736923 21451 195.159.176.226 (31 Dec 2017 16:15:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 31 Dec 2017 16:15:23 +0000 (UTC) Cc: 29812@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 31 17:15:19 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVgGY-00053M-5J for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Dec 2017 17:15:14 +0100 Original-Received: from localhost ([::1]:44058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eVgIX-0000cD-66 for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Dec 2017 11:17:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eVgIM-0000ap-BO for bug-gnu-emacs@gnu.org; Sun, 31 Dec 2017 11:17:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eVgII-0004BN-AT for bug-gnu-emacs@gnu.org; Sun, 31 Dec 2017 11:17:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50218) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eVgII-0004BC-7N for bug-gnu-emacs@gnu.org; Sun, 31 Dec 2017 11:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eVgIH-0001JK-Qg for bug-gnu-emacs@gnu.org; Sun, 31 Dec 2017 11:17:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Dec 2017 16:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29812 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29812-submit@debbugs.gnu.org id=B29812.15147369814990 (code B ref 29812); Sun, 31 Dec 2017 16:17:01 +0000 Original-Received: (at 29812) by debbugs.gnu.org; 31 Dec 2017 16:16:21 +0000 Original-Received: from localhost ([127.0.0.1]:58899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVgHd-0001IP-2k for submit@debbugs.gnu.org; Sun, 31 Dec 2017 11:16:21 -0500 Original-Received: from mail-qk0-f174.google.com ([209.85.220.174]:33783) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVgHb-0001IC-9o for 29812@debbugs.gnu.org; Sun, 31 Dec 2017 11:16:19 -0500 Original-Received: by mail-qk0-f174.google.com with SMTP id x7so40112094qkb.0 for <29812@debbugs.gnu.org>; Sun, 31 Dec 2017 08:16:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CBaV1eLEXi2Y5NHalAwZPoPxEPYLi3yedCYCGxduiWc=; b=EVxokGQRpKwtqIZxfg/Dz9VfN9IHI7hvpiMma7ThHPpR+u6qcIe72m1fuDOQoDMI65 kSkF53rJvnkfxFGtBoxPHjy2gNzUPKXw8VdJ9gNnaW/Rl35KZQi+v0MK7IqiC1CkwZH6 OoPcylo99+hLh9bulzCzLXiDsH1btIDaa7dVbAHPJdkTZNuCM3yrmpQ6I3ZxtRsIDbOX CNF7zuFTApDcMNiswq3RYZvxMQU9ANg0BXX+tztmz+9zpjaov0gTLn5a9f7CzTlgPPKT 4hixBQIP1kKFTwnALlBdZwEufgSvYFhTO9Rao3+QrG5bSbiEVgFPTVrPfkF8CPkWCt/0 R/dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CBaV1eLEXi2Y5NHalAwZPoPxEPYLi3yedCYCGxduiWc=; b=rjh/QDg3iNtlhiDi6TR7WOQBp+Yz59fxHCuXzxMShSbb0l9DXLaPboDTGXXqHwPyBs t7Dx1b2CCG0HxrG/fWe8JBZipn3OCf8bfv95luV3QnvD/LFt6Uj8wEEnmQtmpkkxnxLm fQpGJ2lMIyOUSBqF4iCZdq5WGVOh7MjSmuYbTrMqYT1QxlLdY/Tm1d0ea9BNpoy951eU gsQW9E04diVlQDtbLoayNg7RmRXWI+yPr0Vc7/Hr8Yhnf3DpFuh8MubRXJyIJ3ca0siT zO6ZJoAQi7wXDUyXkRuwSUyPQ7271M019qyK4nqnDLyJro8quxLvNkhZquVT7NgfEHO4 BMFw== X-Gm-Message-State: AKGB3mK8/Dpl21DLeFP+wwoVf4n9b5YRN5LYapemlpY+yiFix+HLJmtX RmMcTCR3qIAFQ/IDD2T5/6ZEtycP1GjcLsRZwoU= X-Google-Smtp-Source: ACJfBossKztV0fwtKfUyV4EgnFm1I0hYIh9S6RM743RdHl0jJd3zg2s4SCik+tNSeKV6e85rE8Zba7L2McEGE3IywIg= X-Received: by 10.55.10.7 with SMTP id 7mr52365722qkk.198.1514736973699; Sun, 31 Dec 2017 08:16:13 -0800 (PST) In-Reply-To: <83efnaew0p.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141645 Archived-At: --001a114c563e3edfdd0561a52f80 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Eli Zaretskii schrieb am So., 31. Dez. 2017 um 16:51 Uhr: > > From: Philipp Stephani > > Date: Sat, 30 Dec 2017 22:07:16 +0000 > > Cc: 29812@debbugs.gnu.org > > > > emacs -Q > > M-x electric-quote-mode RET > > M-x set-variable RET electric-quote-replace-double RET t RET > > > > Type: > > > > "foo \"foo\"" > > > > You get this in the buffer: > > > > "foo \=E2=80=9Dfoo\=E2=80=9D" > > > > I expected "foo \=E2=80=9Cfoo\=E2=80=9D" instead. > > > > I think it's not completely clear what to expect here. After all, > electric quote is for human-language text, which > > normally doesn't contain backslashes. > > AFAIK, electric-quote-replace-double is supposed to work in comments > and strings in buffers under programming language modes, not only in > text modes. And it works correctly for me in C modes and also in Lisp > comments, so why not in Lisp strings? > Does it work as expected for you in C strings? I see the same behavior in C strings as in Lisp. > > > At least in the context of Emacs Lisp strings, I'd expect "foo \"foo\"" > here, i.e., ASCII quotes. The non-ASCII > > quotes don't need to be escaped, so presumably escaping means that the > user intended to type an ASCII > > quote. > > Typing just a quote in a Lisp string terminates the string, so I > wouldn't expect that to produce curved quotes. And a backslash just > quotes the next character, so there's nothing wrong with having it > before curved quotes. > True, but why would you quote a character that doesn't need quoting? Doing so could be taken as a hint that the character doesn't need quoting. > > Anyway, if this feature is not supposed to work reliably in > programming language strings, perhaps we shouldn't try? Having it > sometimes work and sometimes not is IMO confusing. > It should work in comments and strings, yes. However, given that the behavior is heuristic in all cases it's hard to define what the correct behavior should be. It seems that the behavior you expect should be relatively easy to implement, though. I'll try to send a patch. --001a114c563e3edfdd0561a52f80 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= So., 31. Dez. 2017 um 16:51=C2=A0Uhr:
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sat, 30 Dec 2017 22:07:16 +0000
> Cc: 29812@d= ebbugs.gnu.org
>
>=C2=A0 =C2=A0 emacs -Q
>=C2=A0 =C2=A0 M-x electric-quote-mode RET
>=C2=A0 =C2=A0 M-x set-variable RET electric-quote-replace-double RET t = RET
>
>=C2=A0 Type:
>
>=C2=A0 =C2=A0 "foo \"foo\""
>
>=C2=A0 You get this in the buffer:
>
>=C2=A0 =C2=A0 "foo \=E2=80=9Dfoo\=E2=80=9D"
>
>=C2=A0 I expected "foo \=E2=80=9Cfoo\=E2=80=9D" instead.
>
> I think it's not completely clear what to expect here. After all, = electric quote is for human-language text, which
> normally doesn't contain backslashes.

AFAIK, electric-quote-replace-double is supposed to work in comments
and strings in buffers under programming language modes, not only in
text modes.=C2=A0 And it works correctly for me in C modes and also in Lisp=
comments, so why not in Lisp strings?

D= oes it work as expected for you in C strings? I see the same behavior in C = strings as in Lisp.
=C2=A0

> At least in the context of Emacs Lisp strings, I'd expect "fo= o \"foo\"" here, i.e., ASCII quotes. The non-ASCII
> quotes don't need to be escaped, so presumably escaping means that= the user intended to type an ASCII
> quote.

Typing just a quote in a Lisp string terminates the string, so I
wouldn't expect that to produce curved quotes.=C2=A0 And a backslash ju= st
quotes the next character, so there's nothing wrong with having it
before curved quotes.

True, but why wou= ld you quote a character that doesn't need quoting? Doing so could be t= aken as a hint that the character doesn't need quoting.
=C2= =A0

Anyway, if this feature is not supposed to work reliably in
programming language strings, perhaps we shouldn't try?=C2=A0 Having it=
sometimes work and sometimes not is IMO confusing.
It should work in comments and strings, yes. However, given tha= t the behavior is heuristic in all cases it's hard to define what the c= orrect behavior should be.
It seems that the behavior you expect = should be relatively easy to implement, though. I'll try to send a patc= h.=C2=A0
--001a114c563e3edfdd0561a52f80--