From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jean-Christophe Helary Newsgroups: gmane.emacs.devel Subject: Re: prin1 / princ vs message ? Date: Sun, 2 Jul 2017 23:02:09 +0900 Message-ID: References: <061782A1-0A51-49A1-9AA4-706AF8927D01@gmail.com> <94EF128F-6A3D-41DD-B92D-0C165A4A8EB9@gmail.com> <617557F2-0316-4504-BE80-E7F29E4EE347@gmail.com> <86E604C6-4A01-42D2-A3CD-D758FC5DD8B1@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_A2E471DD-4DE0-4A4E-BD31-85ACBF05F482" X-Trace: blaine.gmane.org 1499004201 6113 195.159.176.226 (2 Jul 2017 14:03:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Jul 2017 14:03:21 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 02 16:03:12 2017 Return-path: Envelope-to: ged-emacs-devel@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 1dRfSx-00016B-N0 for ged-emacs-devel@m.gmane.org; Sun, 02 Jul 2017 16:03:11 +0200 Original-Received: from localhost ([::1]:58145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRfT3-0000os-4i for ged-emacs-devel@m.gmane.org; Sun, 02 Jul 2017 10:03:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRfS5-0000nd-5f for emacs-devel@gnu.org; Sun, 02 Jul 2017 10:02:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dRfS2-0004Kb-2t for emacs-devel@gnu.org; Sun, 02 Jul 2017 10:02:17 -0400 Original-Received: from mail-pg0-x22c.google.com ([2607:f8b0:400e:c05::22c]:36348) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dRfS1-0004JQ-QX for emacs-devel@gnu.org; Sun, 02 Jul 2017 10:02:14 -0400 Original-Received: by mail-pg0-x22c.google.com with SMTP id u62so83162331pgb.3 for ; Sun, 02 Jul 2017 07:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=Jk/lXGgVwDKE8ddkffpgwWzEXV1Awx/nHw7DJRiaKas=; b=YiXy3JYWNXTGxqk/jnEJADUDUveZf2Op5lcGq3P9LhqV+9NR3lQooitNiemSbhQ4uj g0euWy9WsPq+k2KmyI5CVBu6zknw5pQAvmxw6bZ6KmrGWrYl5zEEjSVe7+07aBvTsbCM DCJ+QFzxd4QIlBQC3kW0yiXlEtZZFPBJt1IajTTcJtFWRZxwGRg/ZZ1sSYJ307FvnrF0 ulCdGYzlSeslDz8tBXHTFPcTY131lcPt5hvveVrR+2h0sfxQFr3xH0w96rU3XPn9oT0Q 7v2aamwwa0kmLiFNdiA56m9jFJIdvG39lo78WuYTnAw5JrTRHcMbVuCUCg4Sel6ZPWqJ jouQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=Jk/lXGgVwDKE8ddkffpgwWzEXV1Awx/nHw7DJRiaKas=; b=JrdSuC1XbOUyGV8hMKF4ExDlAs/5zaBRJq7hvQySrrZzPzIFMfJMVERMBXuO7w06ZP YtgD/hifw7/DBK0Mpt4K63gX7up51tVahe/WE5mGEKvab+klx7h03VXdVY5gMkb0m21h buW4EGh8D2NXi/truZ4FqOa0r+UVEwnNlk5On0lhcw4gGoR3hU/XoPwXmu3Sc0viGigg VAo5Z24BecA0CfZXfyPYntMQs21mT7P0IQjOFflMdQLCB4ltjeaPW1t9VNfX0LR7UIPa Kqk8VpvswKBNYUKO61/dXThc94bXc5/TYVBZ30rvxaNeNkpaBp8u6+HSnthi0J2u6HOw tgrw== X-Gm-Message-State: AIVw111F331Q+cPkdQAOeAZ4Xy/QpKAlJiEUuT/CdDWRvQFOkhpJ9/4H yNxuAHKueSPvhGZHrjQ= X-Received: by 10.84.216.71 with SMTP id f7mr5531361plj.266.1499004132449; Sun, 02 Jul 2017 07:02:12 -0700 (PDT) Original-Received: from [192.168.24.55] (pl2587.ag0304.nttpc.ne.jp. [128.53.196.27]) by smtp.gmail.com with ESMTPSA id z86sm32485097pfl.40.2017.07.02.07.02.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jul 2017 07:02:11 -0700 (PDT) In-Reply-To: <86E604C6-4A01-42D2-A3CD-D758FC5DD8B1@gmail.com> X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:216099 Archived-At: --Apple-Mail=_A2E471DD-4DE0-4A4E-BD31-85ACBF05F482 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Conclusion of that exchange (sorry for being a little slow to understand = everything the 3 of you wrote): This: (prin1 name) (princ " is ") (princ (if (memq (aref status 0) '(?a ?e ?i ?o ?u)) "an " "a ")) (princ status) (princ " package.\n\n") Can reasonably be replaced by this: (let (sentence (format "The status of package %1$S is `%2$s'.\n\n" = name status))) (princ sentence)) Is that correct ? (I am using the numbered fields that Philipp Stephani = implemented in June.)=20 Jean-Christophe > On Jul 2, 2017, at 22:47, Jean-Christophe Helary = wrote: >=20 >=20 >> On Jul 2, 2017, at 22:21, Tino Calancha > wrote: >>=20 >>> Instead of using message to replace that code: >>>=20 >>> (let ((name "JC")) >>> (prin1 "My name ") >>> (princ " is ") >>> (princ name) >>> (princ ".\n\n")) >>>=20 >>> It would be better to use something like: >>>=20 >>> (let ((sentence (format "My name is %s.\n\n))) >>> (prin1 sentence)) >>>=20 >>> That way I keep the possibility to redirect the output somewhere = else while making the sentence actually maintainable... >> That's sounds pretty OK. >> I would just modify a bit your example, because currenty doesn't = work, >> you get the error: >> read-from-minibuffer: End of file during parsing >=20 > Yes, I just realized that I had forgotten a lot of required stuff :) = Sorry. >=20 > As for Noam's question, the mixing is, I guess, intended but was not = properly reflected in my example: >=20 > (let ((name "JC")) > (princ "My name ") > (princ " is ") > (prin1 name) > (princ ".\n\n")) >=20 >=20 > Jean-Christophe=20 --Apple-Mail=_A2E471DD-4DE0-4A4E-BD31-85ACBF05F482 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
Conclusion of that exchange (sorry for being = a little slow to understand everything the 3 of you wrote):

This:
    (prin1 name)
  =   (princ " is ")
    (princ = (if (memq (aref status 0) '(?a ?e ?i ?o ?u)) "an = " "a "))
    (princ status)
    (princ " package.\n\n")

Can reasonably be = replaced by this:
  =   (let (sentence (format "The status of package %1$S = is `%2$s'.\n\n" name status)))
  =   (princ sentence))

Is that correct ? (I am using the numbered fields that = Philipp Stephani implemented in June.) 

Jean-Christophe

On = Jul 2, 2017, at 22:47, Jean-Christophe Helary <jean.christophe.helary@gmail.com> wrote:


On Jul 2, 2017, at 22:21, Tino Calancha <tino.calancha@gmail.com> wrote:
Instead of using message to = replace that code:

(let ((name "JC"))
(prin1 "My name ")
(princ " is ")
(princ name)
(princ ".\n\n"))

It would be better to use something like:

(let ((sentence (format "My name is %s.\n\n)))
   (prin1 sentence))

That way I keep the possibility to redirect the output = somewhere else while making the sentence actually maintainable...
That's sounds pretty OK.
I would just modify a bit your example, because = currenty doesn't work,
you get the = error:
read-from-minibuffer: End of file during = parsing

Yes, I just realized = that I had forgotten a lot of required stuff :) Sorry.

As for Noam's question, = the mixing is, I guess, intended but was not properly reflected in my = example:

(let ((name = "JC"))
(princ "My name = ")
(princ " is = ")
(prin1 name)
(princ = ".\n\n"))


Jean-Christophe 

= --Apple-Mail=_A2E471DD-4DE0-4A4E-BD31-85ACBF05F482--