all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Return value not as expected in Emacs Lisp function
@ 2013-08-07 18:48 Thorsten Jolitz
  2013-08-07 21:00 ` Stefan Monnier
  2013-08-07 21:07 ` Pascal J. Bourguignon
  0 siblings, 2 replies; 7+ messages in thread
From: Thorsten Jolitz @ 2013-08-07 18:48 UTC (permalink / raw)
  To: help-gnu-emacs


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




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-08-09 12:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-07 18:48 Return value not as expected in Emacs Lisp function Thorsten Jolitz
2013-08-07 21:00 ` Stefan Monnier
2013-08-07 22:47   ` Thorsten Jolitz
2013-08-07 21:07 ` Pascal J. Bourguignon
2013-08-07 22:54   ` Thorsten Jolitz
2013-08-08 22:31     ` Pascal J. Bourguignon
2013-08-09 12:03       ` Thorsten Jolitz

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.