emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* emacs-lisp babel won't print
@ 2015-09-25 16:04 Lawrence Bottorff
  2015-09-25 16:32 ` John Kitchin
  2015-09-25 16:48 ` Charles Millar
  0 siblings, 2 replies; 3+ messages in thread
From: Lawrence Bottorff @ 2015-09-25 16:04 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

If I do this:

#+BEGIN_SRC emacs-lisp
(setq animals '(gazelle giraffe lion tiger))
#+END_SRC

#+RESULTS:
| gazelle | giraffe | lion | tiger |

and then this

#+begin_src emacs-lisp
(defun print-elements-of-list (list)
  "Print each element of LIST on a line of its own."
  (while list
    (print (car list))
    (setq list (cdr list))))
#+end_src

#+RESULTS:
: print-elements-of-list

and finally

#+BEGIN_SRC emacs-lisp
(print-elements-of-list animals)
#+END_SRC

I get nothing for results and "Code block produced no output." in Messages.
Why can't it print out? Same code works fine in the IELM buffer.

LB

[-- Attachment #2: Type: text/html, Size: 1043 bytes --]

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

* Re: emacs-lisp babel won't print
  2015-09-25 16:04 emacs-lisp babel won't print Lawrence Bottorff
@ 2015-09-25 16:32 ` John Kitchin
  2015-09-25 16:48 ` Charles Millar
  1 sibling, 0 replies; 3+ messages in thread
From: John Kitchin @ 2015-09-25 16:32 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist

try:

#+BEGIN_SRC emacs-lisp :results output
(print-elements-of-list animals)
#+END_SRC

the default results are value, and your function does not return
anything I think. It prints them to output.

Lawrence Bottorff writes:

> If I do this:
>
> #+BEGIN_SRC emacs-lisp
> (setq animals '(gazelle giraffe lion tiger))
> #+END_SRC
>
> #+RESULTS:
> | gazelle | giraffe | lion | tiger |
>
> and then this
>
> #+begin_src emacs-lisp
> (defun print-elements-of-list (list)
>   "Print each element of LIST on a line of its own."
>   (while list
>     (print (car list))
>     (setq list (cdr list))))
> #+end_src
>
> #+RESULTS:
> : print-elements-of-list
>
> and finally
>
> #+BEGIN_SRC emacs-lisp
> (print-elements-of-list animals)
> #+END_SRC
>
> I get nothing for results and "Code block produced no output." in Messages.
> Why can't it print out? Same code works fine in the IELM buffer.
>
> LB

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

* Re: emacs-lisp babel won't print
  2015-09-25 16:04 emacs-lisp babel won't print Lawrence Bottorff
  2015-09-25 16:32 ` John Kitchin
@ 2015-09-25 16:48 ` Charles Millar
  1 sibling, 0 replies; 3+ messages in thread
From: Charles Millar @ 2015-09-25 16:48 UTC (permalink / raw)
  To: emacs-orgmode

maybe add :results output to the last block

On 09/25/2015 12:04 PM, Lawrence Bottorff wrote:
> #+BEGIN_SRC emacs-lisp
> (setq animals '(gazelle giraffe lion tiger))
> #+END_SRC
>
> #+RESULTS:
> | gazelle | giraffe | lion | tiger |
>
> and then this
>
> #+begin_src emacs-lisp
> (defun print-elements-of-list (list)
>   "Print each element of LIST on a line of its own."
>   (while list
>     (print (car list))
>     (setq list (cdr list))))
> #+end_src
>
> #+RESULTS:
> : print-elements-of-list
>
> and finally
>
> #+BEGIN_SRC emacs-lisp
> (print-elements-of-list animals)
> #+END_SRC

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

end of thread, other threads:[~2015-09-25 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-25 16:04 emacs-lisp babel won't print Lawrence Bottorff
2015-09-25 16:32 ` John Kitchin
2015-09-25 16:48 ` Charles Millar

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).