From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Return value not as expected in Emacs Lisp function
Date: Wed, 07 Aug 2013 20:48:12 +0200 [thread overview]
Message-ID: <8738qlfic3.fsf@gmail.com> (raw)
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
next reply other threads:[~2013-08-07 18:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 18:48 Thorsten Jolitz [this message]
2013-08-07 21:00 ` Return value not as expected in Emacs Lisp function 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8738qlfic3.fsf@gmail.com \
--to=tjolitz@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.