emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ob-clojure: presentation of map structures?
@ 2014-02-02  6:42 Phill Wolf
  2014-02-02  7:06 ` Eric Schulte
  2014-02-02 22:26 ` Soapy Smith
  0 siblings, 2 replies; 3+ messages in thread
From: Phill Wolf @ 2014-02-02  6:42 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

How may I use an Org document to illustrate Clojure src blocks that produce
Clojure data structures -- particularly maps -- as pretty-printed text?  I
think I am using Org "master" in Emacs 24.3.

#+BEGIN_SRC clojure :results value <<what options?>>
(zipmap
  ["Peru" "Paris" "Sankt-Peterburg" "Philadelphia" "Plattsburgh" "Pluto"]
  (range))
#+END_SRC

By the way, Clojure pprint makes the value into the following, which would
be very respectable (with the addition of ":" org markup) as a result block
in the Org buffer:

{"Pluto" 5,
 "Plattsburgh" 4,
 "Philadelphia" 3,
 "Putingrad" 2,
 "Paris" 1,
 "Peru" 0}

Floundering among the options, I tried :results value pp.  It yielded this:

: "{\"Pluto\" 5,\n \"Plattsburgh\" 4,\n \"Philadelphia\" 3,\n
\"Sankt-Peterburg\" 2,\n \"Paris\" 1,\n \"Peru\" 0}\n"

pprint's good intentions are evident, but they collided with a superior
force.

[-- Attachment #2: Type: text/html, Size: 1268 bytes --]

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

* Re: ob-clojure: presentation of map structures?
  2014-02-02  6:42 ob-clojure: presentation of map structures? Phill Wolf
@ 2014-02-02  7:06 ` Eric Schulte
  2014-02-02 22:26 ` Soapy Smith
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Schulte @ 2014-02-02  7:06 UTC (permalink / raw)
  To: Phill Wolf; +Cc: emacs-orgmode

Phill Wolf <phill.wolf@gmail.com> writes:

> How may I use an Org document to illustrate Clojure src blocks that produce
> Clojure data structures -- particularly maps -- as pretty-printed text?  I
> think I am using Org "master" in Emacs 24.3.
>
> #+BEGIN_SRC clojure :results value <<what options?>>
> (zipmap
>   ["Peru" "Paris" "Sankt-Peterburg" "Philadelphia" "Plattsburgh" "Pluto"]
>   (range))
> #+END_SRC
>
> By the way, Clojure pprint makes the value into the following, which would
> be very respectable (with the addition of ":" org markup) as a result block
> in the Org buffer:
>
> {"Pluto" 5,
>  "Plattsburgh" 4,
>  "Philadelphia" 3,
>  "Putingrad" 2,
>  "Paris" 1,
>  "Peru" 0}
>
> Floundering among the options, I tried :results value pp.  It yielded this:
>
> : "{\"Pluto\" 5,\n \"Plattsburgh\" 4,\n \"Philadelphia\" 3,\n
> \"Sankt-Peterburg\" 2,\n \"Paris\" 1,\n \"Peru\" 0}\n"
>
> pprint's good intentions are evident, but they collided with a superior
> force.

Maybe try ":results pp org".

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

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

* Re: ob-clojure: presentation of map structures?
  2014-02-02  6:42 ob-clojure: presentation of map structures? Phill Wolf
  2014-02-02  7:06 ` Eric Schulte
@ 2014-02-02 22:26 ` Soapy Smith
  1 sibling, 0 replies; 3+ messages in thread
From: Soapy Smith @ 2014-02-02 22:26 UTC (permalink / raw)
  To: Phill Wolf; +Cc: emacs-orgmode

On Sun, 2014-02-02 at 01:42 -0500, Phill Wolf wrote:

> Floundering among the options, I tried :results value pp.  It yielded
> this:
> 
> : "{\"Pluto\" 5,\n \"Plattsburgh\" 4,\n \"Philadelphia\" 3,\n
> \"Sankt-Peterburg\" 2,\n \"Paris\" 1,\n \"Peru\" 0}\n"
> 
> 
> pprint's good intentions are evident, but they collided with a
> superior force.

There was a discussion of this at the Clojure google group:
https://groups.google.com/d/msg/clojure/gthjNWfAWKo/aKwuqh2qx68J

The tabularization problem was resolved, but the pp of the map behavior
is not changed.  I tried a few permutations of :results options, and did
not get close to the Clojure pprint function.

The org manual says the pp option is "This
option currently supports Emacs Lisp, Python, and Ruby. E.g., :results
value pp."

Regards,
Greg

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

end of thread, other threads:[~2014-02-02 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-02  6:42 ob-clojure: presentation of map structures? Phill Wolf
2014-02-02  7:06 ` Eric Schulte
2014-02-02 22:26 ` Soapy Smith

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