[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: [babel] allow emacs-lisp results to be pretty-printed
From: |
Eric Schulte |
Subject: |
[Orgmode] Re: [babel] allow emacs-lisp results to be pretty-printed |
Date: |
Sun, 18 Oct 2009 10:12:39 -0600 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (darwin) |
"Eric Schulte" <address@hidden> 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