[Top][All Lists]

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

Re: prin1 / princ vs message ?

From: Jean-Christophe Helary
Subject: Re: prin1 / princ vs message ?
Date: Sun, 2 Jul 2017 21:21:47 +0900

On Jul 2, 2017, at 20:57, Tino Calancha <address@hidden> wrote:

What's the difference between:

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


(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’".
 Extracted from:
(info "(elisp) Programming Tips")

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


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 ?


reply via email to

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