emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Benjamin Andresen <benny@in-ulm.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [babel] allow emacs-lisp results to be pretty-printed
Date: Sun, 18 Oct 2009 10:12:39 -0600	[thread overview]
Message-ID: <m2pr8kllzc.fsf_-_@gmail.com> (raw)
In-Reply-To: <m2iqevi24b.fsf@gmail.com> (Eric Schulte's message of "Sun, 04 Oct 2009 09:56:52 -0600")

"Eric Schulte" <schulte.eric@gmail.com> writes:

>>
>>> WRT the pp patch for emacs-lisp, I think it is an excellent addition and
>>> in fact I think that it points to a more general need.  Languages should
>>> have the option of returning values as they would appear when written in
>>> the language.  That is how they would be printed in a source-code file.
>>> This seems to be what your pp patch does for emacs-lisp.  In fact such
>>> output should be wrapped in a #+begin/end-src block for fontification of
>>> the results on export.
>>

This is now implemented behind the "code" header argument.  The
following now works with the most recent version of Org-mode.  The
"code" header argument currently has explicit support in emacs-lisp,
ruby, and python.

Best -- Eric

#+begin_src emacs-lisp :results code
  (mapcar (lambda (el) (lambda (item) (+ item el))) '(1 2 3 4 5))
#+end_src

#+resname:
#+BEGIN_SRC emacs-lisp
((lambda
   (item)
   (+ item el))
 (lambda
   (item)
   (+ item el))
 (lambda
   (item)
   (+ item el))
 (lambda
   (item)
   (+ item el))
 (lambda
   (item)
   (+ item el)))
#+END_SRC

#+begin_src ruby :results code
  [1, 2, 33, 4].map{|n| "the number #{n}"}
#+end_src

#+resname:
#+BEGIN_SRC ruby
  ["the number 1", "the number 2", "the number 33", "the number 4"]
#+END_SRC

      parent reply	other threads:[~2009-10-18 16:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-03 18:29 org-babel: [PATCH] allow emacs-lisp results to be pretty-printed Benjamin Andresen
2009-10-03 19:27 ` Benjamin Andresen
     [not found]   ` <m2tyyfi3oz.fsf@gmail.com>
     [not found]     ` <87hbufqi8m.fsf@in-ulm.de>
     [not found]       ` <m2iqevi24b.fsf@gmail.com>
2009-10-18 16:12         ` Eric Schulte [this message]

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2pr8kllzc.fsf_-_@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=benny@in-ulm.de \
    --cc=emacs-orgmode@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 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).