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 21:21:47 +0900 Message-ID: <94EF128F-6A3D-41DD-B92D-0C165A4A8EB9@gmail.com> References: <061782A1-0A51-49A1-9AA4-706AF8927D01@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=_87AC7EB8-D728-4605-8ACC-AADACE21A36B" X-Trace: blaine.gmane.org 1498998124 9322 195.159.176.226 (2 Jul 2017 12:22:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Jul 2017 12:22:04 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 02 14:21:58 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 1dRdsz-00025W-Lc for ged-emacs-devel@m.gmane.org; Sun, 02 Jul 2017 14:21:57 +0200 Original-Received: from localhost ([::1]:57903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRdt4-0001KD-Uo for ged-emacs-devel@m.gmane.org; Sun, 02 Jul 2017 08:22:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRdsy-0001K6-AD for emacs-devel@gnu.org; Sun, 02 Jul 2017 08:21:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dRdsv-0007Dg-5R for emacs-devel@gnu.org; Sun, 02 Jul 2017 08:21:56 -0400 Original-Received: from mail-pf0-x231.google.com ([2607:f8b0:400e:c00::231]:34415) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dRdsu-0007C9-SS for emacs-devel@gnu.org; Sun, 02 Jul 2017 08:21:53 -0400 Original-Received: by mail-pf0-x231.google.com with SMTP id s66so87386816pfs.1 for ; Sun, 02 Jul 2017 05:21:52 -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=YOSD8XP7T0Kmcwcg7mZ2OIMOUzwP7xvqW3R0F7L4dXQ=; b=K+kuzTTjTaMAT8GVjicRGnWR6L5Dlti8MNVctT1ikIeFY3HSTs4Da1TUtaQM54smQR PNS/WioZIKurWShE6LpeFz1uBGf59oCZCOTIU15430KVjsPyYeYjOmEO/fC6+l5hHD0j kNKp/YED1+P02knSw42c4mbiwrk/okhcs9zFFAJPYqMojt6nSkdLkSYr8cpSGDT71Y2+ UCOBplSSJ3WGl3G4YEXFN6pvZQpN8k/1F7KfKfuJiAcDOdMqdJDgZ7S/y43+fGX/Ibmz HwiBQ1absg4GwiJTzGr7s98JvLpu+JbrSJ8nocS+B8jEUE4z4y/JUKypy7h08TNvlnKC zDPw== 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=YOSD8XP7T0Kmcwcg7mZ2OIMOUzwP7xvqW3R0F7L4dXQ=; b=ATHIhHWyhZdHK+bdvxK32haY55atbkmeef30ia8gK15tjnVLpCG2lbHunwEqdh8nq+ 5CqOjDAo9G1yjeMu9n+c3B/YSoM8OcdMhkOyJCHn5XxWzZyY51pm9uN0HWHuzc8Gmfb0 bMGBBlOYqCPiUq9oiIVB3PspBfXoigryfxX51012QrvOyg6X/ZhI751qvLouMk3dwq0C Nvcv3ETLXF5Z0QgsbYoyn+Anal86b+TlcElSzw4nI+gouUlw1fKbGv0DrW04fNQYcqTv Lf2DZkC1ANZnrBeoWQTlt7dJyOJucZ9m+aWkPOC37K56hhkpXHq2ccCRzs3j5cGR7bzw iF1w== X-Gm-Message-State: AIVw1135HpMand1PHSYxFYUPdg6I07w7vBlnUwoRF05kobFKCytDmIvO 8M89FyqDkhsISOB2fEc= X-Received: by 10.98.26.211 with SMTP id a202mr4855988pfa.30.1498998111817; Sun, 02 Jul 2017 05:21:51 -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 c191sm22364107pga.15.2017.07.02.05.21.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jul 2017 05:21:50 -0700 (PDT) In-Reply-To: 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:c00::231 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:216089 Archived-At: --Apple-Mail=_87AC7EB8-D728-4605-8ACC-AADACE21A36B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 2, 2017, at 20:57, Tino Calancha = wrote: >=20 >> What's the difference between: >>=20 >> (let ((name "JC")) >> (prin1 "My name ") >> (princ " is ") >> (princ name) >> (princ ".\n\n")) >>=20 >> and >>=20 >> (message "My name is %s.\n\n" "JC") >>=20 >> ? >>=20 >> Unless we have a non default value for standard-output both send the = value to the echo area, right ? >>=20 >> Besides for the possibility prin1 and princ have of printing to = standard-output and not specifically to the echo area, what is the = actual difference between the two and message ? >=20 > * Documentation about prin? family: > (info "(elisp) Output Functions") >=20 > * "The recommended way to show a message in the echo area is with the > `message' function, not `princ=E2=80=99". > Extracted from: > (info "(elisp) Programming Tips") >=20 > * `message' and the echo area: > (info "(elisp) The Echo Area") Tino, I think that was pretty clear that I had actually read the documentation = about prin1, princ and message. So let me reiterate: I am asking that because I am seeing code where standard-output is not = set to anything but it's default (the echo area) and still prin1/princ = are preferred over message. So, why would a developer chose prin1/princ = over message when there is no stream argument (hence, when the output = goes to standard output). The documentation seems to imply that message should be preferred, but = are there cases where prin1/princ are the best choice ? Jean-Christophe=20= --Apple-Mail=_87AC7EB8-D728-4605-8ACC-AADACE21A36B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On Jul 2, 2017, at 20:57, Tino Calancha <tino.calancha@gmail.com> wrote:

What's the difference = between:

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

and

(message "My name is = %s.\n\n" "JC")

?

Unless we have a non default value for standard-output both = send the value to the echo area, right ?

Besides for the possibility prin1 and princ have of printing = to standard-output and not specifically to the echo area, what is the = actual difference between the two and message ?

* Documentation = about prin? family:
(info "(elisp) = Output Functions")

* "The recommended way to show a message in the = echo area is with the
 `message' = function, not `princ=E2=80=99".
 Extracted = from:
(info "(elisp) Programming = Tips")

* `message' and the = echo area:
(info "(elisp) The Echo = Area")

Tino,

I think that was pretty clear that I had actually read the = documentation about prin1, princ and message. So let me = reiterate:

I = am asking that because I am seeing code where standard-output is not set = to anything but it's default (the echo area) and still prin1/princ are = preferred over message. So, why would a developer chose prin1/princ over = message when there is no stream argument (hence, when the output goes to = standard output).

The documentation seems to imply that message should be = preferred, but are there cases where prin1/princ are the best choice = ?

Jean-Christophe 
= --Apple-Mail=_87AC7EB8-D728-4605-8ACC-AADACE21A36B--