unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: prin1 / princ vs message ?
Date: Sun, 2 Jul 2017 21:44:16 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1707022132300.13347@calancha-pc> (raw)
In-Reply-To: <94EF128F-6A3D-41DD-B92D-0C165A4A8EB9@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1709 bytes --]



On Sun, 2 Jul 2017, Jean-Christophe Helary wrote:

> * 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’".
>  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:
Appologies,  i misunderstood that.
> 
> 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 ?
In my case i use `message' most of the time.
I just use `prin?' things when i want to insert the printable 
representation of a lisp object withing a buffer.  Not so often, though.

In files, like
international/quail.el
or
international/mule-diag.el

note that they use the macro `with-output-to-temp-buffer', so they
must use `prin?' instead of `message' to collect the standard-output.

Even when `with-output-to-temp-buffer' is not called explicitely in
the file, like in
lisp/cus-theme.el

you better use `prin?' there, because those are messages related with
the Emacs help, i mean, they will appear in *Help* buffers which
are build binding standard-output.

Other than that i would stick with `message'.

  parent reply	other threads:[~2017-07-02 12:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-02 10:12 prin1 / princ vs message ? Jean-Christophe Helary
2017-07-02 11:57 ` Tino Calancha
2017-07-02 12:21   ` Jean-Christophe Helary
2017-07-02 12:32     ` Andreas Schwab
2017-07-02 12:41       ` Jean-Christophe Helary
2017-07-02 12:44     ` Tino Calancha [this message]
2017-07-02 12:45     ` Noam Postavsky
2017-07-02 13:09       ` Jean-Christophe Helary
2017-07-02 13:17         ` Noam Postavsky
2017-07-02 13:21         ` Tino Calancha
2017-07-02 13:47           ` Jean-Christophe Helary
2017-07-02 14:02             ` Jean-Christophe Helary
2017-07-02 14:23               ` Tino Calancha
2017-07-02 14:26                 ` Jean-Christophe Helary
2017-07-02 14:27               ` Philipp Stephani
2017-07-02 14:38                 ` Jean-Christophe Helary
2017-07-02 14:30               ` (format "Hello %1$S%2$s" 'world "!") Clément Pit-Claudel
2017-07-02 14:39                 ` Jean-Christophe Helary
2017-07-02 15:03                 ` Noam Postavsky
2017-07-02 16:32                   ` Clément Pit-Claudel
2017-07-02 16:54                     ` Noam Postavsky
2017-07-02 17:25                       ` Clément Pit-Claudel
2017-12-22 21:50                         ` Philipp Stephani
2017-07-02 16:56                     ` Vivek Dasmohapatra
2017-12-22 21:48                     ` Philipp Stephani
2017-12-22 21:44                 ` Philipp Stephani
2017-07-02 14:29 ` prin1 / princ vs message ? Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1707022132300.13347@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=jean.christophe.helary@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).