You can try using tools.reader[1]'s source-logging-push-back-reader:

user=> (require '[clojure.tools.reader :as r]
  #_=>          '[clojure.tools.reader.reader-types :as readers])
nil

user=> (-> "{  :foo [ bar] }" readers/source-logging-push-back-reader
           r/read meta :source)
"{  :foo [ bar] }"

[1]https://github.com/clojure/tools.reader

Sarkis Karayan writes:

> Hey guys,
>
> Is there a similar function to read-string that preserves formatting info
> (perhaps by storing formatting info as metadata)?
>
> My app does a read-string on a clojure file and saves the content to
> datomic (each fn is stored in an entity, each file can have multiple fns).
>
> The difficulty that I am having is that the formatting isn't preserved when
> I read the content of the fn from datomic.
>
> Any advice?
>
> Thanks,
> Sarkis

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to