Rick Moynihan <rick.moyni...@gmail.com> writes:

>
> Basically it looks like the different :results types haven't yet been
> implemented...  The one I was missing was 'code'  e.g. the following
> works for elisp:
>
> #+begin_src emacs-lisp :results code
>   '(+ 10 1)
> #+end_src
>
> displaying:
>
> #+results:
> #+BEGIN_SRC emacs-lisp
> (+ 10 1)
> #+END_SRC
>
> But in clojure I get:
>
> #+begin_src clojure :results code
>   '(+ 10 1)
> #+end_src
>
> #+results:
> | + | 10 | 1 |
>

I've just pushed up an implementation of this feature.  It uses
Clojure's pretty printer which has different settings for printing code
and data.  This can be controlled through use of the "code" (for code)
and "pp" (for data) arguments to :results, here's example output with
the new implementation.

#+begin_src clojure :results pp
  '(defn cl-format 
     "An implementation of a Common Lisp compatible format function"
     [stream format-in & args]
     (let [compiled-format (if (string? format-in) (compile-format format-in) 
format-in)
           navigator (init-navigator args)]
       (execute-format stream compiled-format navigator)))
#+end_src

#+results:
#+begin_example
(defn
 cl-format
 "An implementation of a Common Lisp compatible format function"
 [stream format-in & args]
 (let
  [compiled-format
   (if (string? format-in) (compile-format format-in) format-in)
   navigator
   (init-navigator args)]
  (execute-format stream compiled-format navigator)))
#+end_example

#+begin_src clojure :results code
  '(defn cl-format 
     "An implementation of a Common Lisp compatible format function"
     [stream format-in & args]
     (let [compiled-format (if (string? format-in) (compile-format format-in) 
format-in)
           navigator (init-navigator args)]
       (execute-format stream compiled-format navigator)))
#+end_src

#+results:
#+BEGIN_SRC clojure
(defn cl-format
  "An implementation of a Common Lisp compatible format function"
  [stream format-in & args]
  (let [compiled-format (if (string? format-in)
                          (compile-format format-in)
                          format-in)
        navigator (init-navigator args)]
    (execute-format stream compiled-format navigator)))
#+END_SRC

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to