From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [babel] allow emacs-lisp results to be pretty-printed Date: Sun, 18 Oct 2009 10:12:39 -0600 Message-ID: References: <87r5tkqqkk.fsf@in-ulm.de> <87ljjsqnv2.fsf@in-ulm.de> <87hbufqi8m.fsf@in-ulm.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MzYNG-0007XM-Cw for emacs-orgmode@gnu.org; Sun, 18 Oct 2009 12:12:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MzYNB-0007VN-SL for emacs-orgmode@gnu.org; Sun, 18 Oct 2009 12:12:50 -0400 Received: from [199.232.76.173] (port=38146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MzYNB-0007VG-Nd for emacs-orgmode@gnu.org; Sun, 18 Oct 2009 12:12:45 -0400 Received: from mail-pz0-f192.google.com ([209.85.222.192]:39837) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MzYNA-0007ki-61 for emacs-orgmode@gnu.org; Sun, 18 Oct 2009 12:12:44 -0400 Received: by pzk30 with SMTP id 30so3005158pzk.24 for ; Sun, 18 Oct 2009 09:12:42 -0700 (PDT) In-Reply-To: (Eric Schulte's message of "Sun, 04 Oct 2009 09:56:52 -0600") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Benjamin Andresen Cc: emacs-orgmode@gnu.org "Eric Schulte" 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