From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: message in minibuffer Date: Sat, 19 Nov 2005 22:58:52 -0800 Message-ID: References: <1132465960.466513.6320@g49g2000cwa.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1132470109 30562 80.91.229.2 (20 Nov 2005 07:01:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 20 Nov 2005 07:01:49 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 20 08:01:38 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EdjCO-0003tv-7p for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Nov 2005 08:01:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EdjCM-0002Sx-J7 for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Nov 2005 02:01:14 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EdjAG-0002RC-8O for help-gnu-emacs@gnu.org; Sun, 20 Nov 2005 01:59:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EdjAD-0002Qw-Bk for help-gnu-emacs@gnu.org; Sun, 20 Nov 2005 01:59:02 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EdjAB-0002Qp-DR for help-gnu-emacs@gnu.org; Sun, 20 Nov 2005 01:59:00 -0500 Original-Received: from [148.87.122.30] (helo=rgminet01.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EdjAB-0008Gv-I8 for help-gnu-emacs@gnu.org; Sun, 20 Nov 2005 01:58:59 -0500 Original-Received: from rgmsgw301.us.oracle.com (rgmsgw301.us.oracle.com [138.1.186.50]) by rgminet01.oracle.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id jAK6wuZG020489 for ; Sat, 19 Nov 2005 23:58:57 -0700 Original-Received: from rgmsgw301.us.oracle.com (localhost [127.0.0.1]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id jAK6wuT6016256 for ; Sat, 19 Nov 2005 23:58:56 -0700 Original-Received: from dradamslap (dhcp-amer-csvpn-gw2-141-144-73-49.vpn.oracle.com [141.144.73.49]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id jAK6wtBb016243 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Sat, 19 Nov 2005 23:58:56 -0700 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <1132465960.466513.6320@g49g2000cwa.googlegroups.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:31185 Archived-At: Here is a sample piece of code (defun foo () (let ((arg "abc")) (message "Here is arg: %s" arg))) I evaluate this in the minibuffer Eval: (foo) and get "Here is arg: abc" in the [echo area]. However if I evaluate it with M-x foo I get the output Here is arg: abc It seems that the quotation marks show up depending on how the function is invoked. Why? Like many "functions" in Lisp, `message' does two things: 1. It displays a message in the minibuffer. 2. It returns a value: the message that it displayed - a string. #1 is a side effect. #2 is the normal behavior of a true function. But this is more than a question just of `message'... When you evaluate `(foo)' using, for example, `M-:' (command `eval-expression'), you see only the result of the evaluation - that's the behavior of `eval-expression' (it's own side effect): print the result of evaluation in the echo area. When the string value of `message' is printed, it is enclosed in double-quotes, so you can see that the value is a string. In fact, the process of evaluating `M-: (foo)' first calls (message...), which prints your message (without quotes), but then the result of `M-: (foo)' is printed (as a string - showing the quotes), so you never see the first message. If you check buffer *Messages*, you will see your message, without the quotes. When you evaluate `(message...)' using `M-x foo', the result of the evaluation (of `(foo)') is not echoed in the echo area, because function `execute-extended-command' (which is bound to `M-x') does not have such a side effect. IOW, this is all about 1) keeping straight the difference between side effect and resulting value, and 2) knowing the behavior of the given functions (`eval-expression' vs `execute-extended-command'). "Are we having fun yet?", asks Zippy, tossing his "Elementary Haskell" manual into the dryer and turning the dial to "Delicates". "We'll see if it's really Purely Functional and 100% Fully Lazy..." HTH.