emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: prin1 / princ vs message ?


From: Tino Calancha
Subject: Re: prin1 / princ vs message ?
Date: Sun, 2 Jul 2017 21:44:16 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)



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'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]