emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: Emacs-orgmode Digest, Vol 62, Issue 11
       [not found] <0LJG00AQ51TP5FC0@smtpin127.mac.com>
@ 2011-04-10 21:54 ` Matthew Oesting
  2011-04-10 22:45   ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Oesting @ 2011-04-10 21:54 UTC (permalink / raw)
  To: emacs-orgmode

I am sure that this is a trivially simple issue that I've simply overlooked in the manual, but by God, I've been studiously overlooking it for about an hour...

I simply print a few things...

  #+BEGIN_SRC emacs-lisp :export output
    
    (let ( 
          (dog (sqrt 2))
          (cat 7)
          )
    
      (print (format "%s %f" "Dog: " (eval dog)))
      (print (format "%s %d" "Cat: " (eval cat)) nil)
      (print "Fish.")   
      )  
    
#+END_SRC

#+results:
: Fish.

Only the last value ever survives the printing process.  One line attempts to print to standard out without specification, and the other names the stream specifically, but in all cases, only the last message ever seems to survive.  It is as if all messages are directed to the minibuffer, happily clobbering previous output like a sequence of baby seals, and then that minibuffer is reported as the output stream.

Is there some way to allow for all printed output to survive?

 - M

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

* Re: Re: Emacs-orgmode Digest, Vol 62, Issue 11
  2011-04-10 21:54 ` Emacs-orgmode Digest, Vol 62, Issue 11 Matthew Oesting
@ 2011-04-10 22:45   ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2011-04-10 22:45 UTC (permalink / raw)
  To: Matthew Oesting; +Cc: emacs-orgmode

Hi Matthew,

You're not missing anything obvious, there are two points which are
keeping this from succeeding.

First, emacs-lisp did not support the ":results output", however I've
just pushed up a patch which adds this support to emacs-lisp code
blocks.

Second, you have ":export output" below, when you should have ":results
output", and if you do want to change export options the header argument
is ":exports" (plural) not ":export".  I really need to implement some
sort of highlighting to catch these small header-argument errors as
they're extremely common.

With the latest Org-mode the following should work.

#+begin_src emacs-lisp :results output
  (let ((dog (sqrt 2))
        (cat 7))
    (print (format "%s %f" "Dog: " (eval dog)))
    (print (format "%s %d" "Cat: " (eval cat)) nil)
    (print "Fish."))
#+end_src

#+results:
: 
: "Dog:  1.414214"
: 
: "Cat:  7"
: 
: "Fish."

Although I'd recommend returning the value as a list

#+begin_src emacs-lisp
  (let ((dog (sqrt 2))
        (cat 7))
    `((dog ,dog)
      (cat ,cat)
      (fish)))
#+end_src

#+results:
| dog  | 1.4142135623730951 |
| cat  |                  7 |
| fish |                    |

Cheers -- Eric

Matthew Oesting <oestingm@me.com> writes:

> I am sure that this is a trivially simple issue that I've simply overlooked in the manual, but by God, I've been studiously overlooking it for about an hour...
>
> I simply print a few things...
>
>   #+BEGIN_SRC emacs-lisp :export output
>     
>     (let ( 
>           (dog (sqrt 2))
>           (cat 7)
>           )
>     
>       (print (format "%s %f" "Dog: " (eval dog)))
>       (print (format "%s %d" "Cat: " (eval cat)) nil)
>       (print "Fish.")   
>       )  
>     
> #+END_SRC
>
> #+results:
> : Fish.
>
> Only the last value ever survives the printing process.  One line
> attempts to print to standard out without specification, and the other
> names the stream specifically, but in all cases, only the last message
> ever seems to survive.  It is as if all messages are directed to the
> minibuffer, happily clobbering previous output like a sequence of baby
> seals, and then that minibuffer is reported as the output stream.
>
> Is there some way to allow for all printed output to survive?
>
>  - M
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

end of thread, other threads:[~2011-04-10 22:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <0LJG00AQ51TP5FC0@smtpin127.mac.com>
2011-04-10 21:54 ` Emacs-orgmode Digest, Vol 62, Issue 11 Matthew Oesting
2011-04-10 22:45   ` Eric Schulte

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).