From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Return value not as expected in Emacs Lisp function Date: Wed, 07 Aug 2013 20:48:12 +0200 Message-ID: <8738qlfic3.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1375901332 1180 80.91.229.3 (7 Aug 2013 18:48:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Aug 2013 18:48:52 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 07 20:48:53 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V78mw-00024u-U1 for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Aug 2013 20:48:51 +0200 Original-Received: from localhost ([::1]:54858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V78mw-0008B5-Jb for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Aug 2013 14:48:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V78mf-0008An-Nd for help-gnu-emacs@gnu.org; Wed, 07 Aug 2013 14:48:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V78mY-00045c-4H for help-gnu-emacs@gnu.org; Wed, 07 Aug 2013 14:48:33 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:33065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V78mX-00045R-Tq for help-gnu-emacs@gnu.org; Wed, 07 Aug 2013 14:48:26 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V78mV-0001lC-Md for help-gnu-emacs@gnu.org; Wed, 07 Aug 2013 20:48:23 +0200 Original-Received: from e178063213.adsl.alicedsl.de ([85.178.63.213]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 07 Aug 2013 20:48:23 +0200 Original-Received: from tjolitz by e178063213.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 07 Aug 2013 20:48:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 58 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178063213.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:oapmbQ6JJjQYZ9UHanJoRjTX5Po= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92770 Archived-At: Hi List, I have a hard time to understand the following behaviour of an Emacs Lisp program of mine. Here is an abstract version of this program: #+begin_src emacs-lisp (defun my-fun () (let ((result (concat "(prog " (mapconcat (lambda ...) lst "") ")"))) (message "%s" result) ; just for logging result)) #+end_src After running the program, I find, as expected, something like this in the *Messages* buffer: #+begin_quote (prog (click NIL 1)(press NIL 1)(click NIL 4)(click NIL 1)) #+end_quote so the value of 'result' is just fine in the second-last line of the fun. But the return value is not what I would expect #+begin_src emacs-lisp (print (my-fun)) #+end_src or #+begin_src emacs-lisp (message "%s" (my-fun)) #+end_src yield #+begin_quote (prog ) #+end_quote and I ask myself what happened between the second-last and the last line of the function? I cannot reproduce this with a MWE, and the real function is too convoluted to present it here, so I keep the problem description on an abstract level. I'm actually only interested in the result string as a return value, the message statement is just for logging. But why is the string produced by 'mapconcat' missing in the return value? -- cheers, Thorsten