From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs,gmane.emacs.devel Subject: bug#23425: master branch: `message' wrongly corrupts ' to curly quote. Date: Mon, 5 Jun 2017 17:14:37 -0700 Organization: UCLA Computer Science Department Message-ID: References: <17c1c00d-a275-5e61-0c47-6872a64a9347@cs.ucla.edu> <20170531212452.GA3789@acm.fritz.box> <07bf5f9d-e8cd-a4d9-1843-b488bfe0b92c@cs.ucla.edu> <20170602210209.GA3570@acm.fritz.box> <11c0adfb-7fdd-8d28-1a47-869e3e7043ea@cs.ucla.edu> <20170603205331.GA2130@acm.fritz.box> <20170605162737.GA30946@acm.fritz.box> <20170605203753.GB30946@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1496708119 27303 195.159.176.226 (6 Jun 2017 00:15:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 6 Jun 2017 00:15:19 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 Cc: 23425@debbugs.gnu.org, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 06 02:15:14 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 1dI29Q-0006hH-Rq for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Jun 2017 02:15:13 +0200 Original-Received: from localhost ([::1]:35651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI29V-0000a8-Ps for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Jun 2017 20:15:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI29H-0000Un-Md for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2017 20:15:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dI29G-0004YA-Gk for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2017 20:15:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55614) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dI29G-0004Xt-Dx for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2017 20:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dI29G-00054R-5d for bug-gnu-emacs@gnu.org; Mon, 05 Jun 2017 20:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Jun 2017 00:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23425 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23425-submit@debbugs.gnu.org id=B23425.149670808819452 (code B ref 23425); Tue, 06 Jun 2017 00:15:02 +0000 Original-Received: (at 23425) by debbugs.gnu.org; 6 Jun 2017 00:14:48 +0000 Original-Received: from localhost ([127.0.0.1]:58291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dI292-00053g-4M for submit@debbugs.gnu.org; Mon, 05 Jun 2017 20:14:48 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dI290-00053T-Fi for 23425@debbugs.gnu.org; Mon, 05 Jun 2017 20:14:47 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CC7051600C7; Mon, 5 Jun 2017 17:14:39 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id FDJa9Rr2zuI2; Mon, 5 Jun 2017 17:14:38 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id AACFF1600F3; Mon, 5 Jun 2017 17:14:38 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id qKKkyMyKhm1F; Mon, 5 Jun 2017 17:14:38 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 5846F1600C7; Mon, 5 Jun 2017 17:14:38 -0700 (PDT) In-Reply-To: <20170605203753.GB30946@acm.fritz.box> Content-Language: en-US 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:133334 gmane.emacs.devel:215464 Archived-At: >> Elisp code needed to use >> (message "%s" STR) even before the change you're objecting to, > > Did it? When and why? Yes, because one can=E2=80=99t pass arbitrary strings to the message func= tion=20 and expect them to be displayed as-is. This has been true for years. For=20 example, lisp/ChangeLog.8 says this: 1999-02-23 Richard M. Stallman * subr.el (with-temp-message): Use %s so % in old msg won't fool us. This use of (message "%s" ...) is still in master, and would still be=20 needed even if we went back to Emacs 24-style message formatting. > Somebody using message to output Lisp will use ' just as I did - and=20 suffer the > same horrendous problems Sure, like the =E2=80=9Chorrendous=E2=80=9D problems with %. For example,= in Emacs 24=20 your example, when used with data involving %: (setq c-parse-state-state '((a '%%))) (message (concat "(setq " (mapconcat (lambda (arg) (format "%s %s%s" (car arg) (if (atom (cdr arg)) "" "'") (if (markerp (cdr arg)) (format "(copy-marker %s)" (marker-position (cdr arg))) (cdr arg)))) c-parse-state-state " ") ")")) returns "(setq a '((quote %)))", which is obviously wrong and which=20 results in silent data corruption. > Do you, perhaps, have another strategem for preventing this problem? Sure: don=E2=80=99t pass arbitrary strings to the message function. > How do you propose to prevent such puzzlement and anger in the future Not by this: >> (error "Can't find `%s' in %s" thing where))) >> =3D> (error "Can%'t find %`%s%' in %s" thing where))) For Emacs code this would likely be a cure worse than the disease, by=20 causing more puzzlement and anger than it would prevent. It would make=20 formats significantly harder to read. And as Cl=C3=A9ment mentioned, it w= ould=20 introduce compatibility problems of its own. There is a better way if the primary goal is to avoid quote translation: (error "Can't find `%s' in %s" thing where))) =3D> (error "Can=E2=80=99t find =E2=80=98%s=E2=80=99 in %s" thin= g where))) Compared to %` and %', this is simpler, easier to read, and more=20 compatible with current and older Emacs versions. A downside, though, is=20 that it would involve changing hundreds or thousands of strings in the=20 Emacs source (just as %` and %' would). > You're not seriously > telling me that any of your students who've written a message call wit= h > a "%s" in the format string remain unaware of the role of %, are you? Sure, they learn about % after the message function doesn=E2=80=99t work = the way=20 they naively expected. In that respect, % is like ` and '. > There are around 275 calls to message which have a non-literal > format argument. Each one stands for possibly many other calls, and we don=E2=80=99t know = how=20 many of these other calls might cause a problem. > The consequences of surreptitious unwanted translation ... >> It's not surreptitious: it's documented. > And this documentation is useless for preventing the problems. True, documentation by itself does not prevent programming problems.=20 However, this doesn=E2=80=99t change the fact that quote translation is=20 documented. It is not =E2=80=9Csurreptitious=E2=80=9D or =E2=80=9Cimplici= t=E2=80=9D or =E2=80=9Cvague=E2=80=9D or=20 =E2=80=9Cstealthy=E2=80=9D or =E2=80=9Cfuzzy=E2=80=9D.