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 22:09:38 +0900 Message-ID: <617557F2-0316-4504-BE80-E7F29E4EE347@gmail.com> References: <061782A1-0A51-49A1-9AA4-706AF8927D01@gmail.com> <94EF128F-6A3D-41DD-B92D-0C165A4A8EB9@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1499001027 30295 195.159.176.226 (2 Jul 2017 13:10:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Jul 2017 13:10:27 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 02 15:10:22 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 1dRedn-0007HG-LO for ged-emacs-devel@m.gmane.org; Sun, 02 Jul 2017 15:10:19 +0200 Original-Received: from localhost ([::1]:58023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRedo-0005Bn-3p for ged-emacs-devel@m.gmane.org; Sun, 02 Jul 2017 09:10:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRedG-0005Bi-Kr for emacs-devel@gnu.org; Sun, 02 Jul 2017 09:09:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dRedD-0003SM-Cb for emacs-devel@gnu.org; Sun, 02 Jul 2017 09:09:46 -0400 Original-Received: from mail-pg0-x234.google.com ([2607:f8b0:400e:c05::234]:35352) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dRedD-0003Rk-4m for emacs-devel@gnu.org; Sun, 02 Jul 2017 09:09:43 -0400 Original-Received: by mail-pg0-x234.google.com with SMTP id j186so82899380pge.2 for ; Sun, 02 Jul 2017 06:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=tq7i0+Pe5BxwuQ5r0UkL4S3iko+M2XHzTEryvKrNBiY=; b=FvlVdzI+ZwPTJXZjuBv4FnT1lyzbDsZ0Y1JP9tMrukki1SAnjTflBzH2Qr/CGNKHsU +IltPo4mVJxcWMnei2G1HpAx2tFMQurP95XebpJq9wQrC62DsRe5a4ByonWtcDP8x+7E 4Bp2psHK9yHTHVPk5mjHZyFhTd0lSzrqptUs7MxHKRqCPywgFsYK0zj07OVJRrTo08Dy alKLigWkfEOxivLe1u3lLTUYVy742g7dK1wHz0Q/HhJHUTqNcAH089mI9ASHBHFOWsDe qgDsNKxLJ6DzM4hlghUXEoxya147b/NYT4+fB4KDuwI05GYRmNotOyMpVNily7ZAGSa2 wyLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=tq7i0+Pe5BxwuQ5r0UkL4S3iko+M2XHzTEryvKrNBiY=; b=JWw6E/z5THDxsV9qaCUc8lvRXYWMXdZqWZp4uaekxLgXP5K9xR0eEUrlO9KyXPcWJl dUGHWI5HTA1YQ9l+krAy8gNjwiaT5sgmIM4VOm6ld1NnfJhssCWPsUOJXqo9rvxkTrfN +ysLqUFuwAYnZ2UQkKZN99jlwdwa2GKSoolWlzWYrAS9OjQV5GTpLcCX7PuW0DyvAiqA HdS7oI/v9PCaBsCo8oxx07oqNA/IYsOooGhDBE1lfO6RdDwF3eMNkhJ6JgsYuLoKZkXX +hKWtLmz0M2Se3GtML3tdwyBouF3B6vWvi8pAaHImalyooUliSge3We76T7c+seZ04sT Lmdg== X-Gm-Message-State: AIVw113x2YMmEyRGsL2UiJSTDumoxqbhKmS2uO4A0y/UkldOUNzZrasb 52qpRwdTmss5OS/FjdQ= X-Received: by 10.84.232.72 with SMTP id f8mr5282777pln.87.1499000981866; Sun, 02 Jul 2017 06:09:41 -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 189sm22999054pgj.67.2017.07.02.06.09.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jul 2017 06:09:41 -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:c05::234 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:216095 Archived-At: Tony, Noam, Thank you very much for the clarifications. So, since I expect the developer to know the difference between the = prin? collection and message could you tell me if the following is = correct: 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... Jean-Christophe > On Jul 2, 2017, at 21:45, Noam Postavsky = wrote: >=20 > On Sun, Jul 2, 2017 at 8:21 AM, Jean-Christophe Helary > wrote: >>=20 >> 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). >=20 > Using prin1/princ lets the caller let-bind standard-output to redirect > the output elsewhere, using message would not allow this. >=20 > Otherwise, I think the only practical difference is that prin1/princ > to the echo area doesn't support message coalescing, e.g., > (progn (message "foo") (message "foo")) will show "foo [2 times]" in > *Messages*, whereas (progn (princ "foo") (princ "foo")) will show > "foofoo".