Permalink
Browse files

Preserve metadata on in-REPL defn

  • Loading branch information...
1 parent 1cdef23 commit 04f8f0cf59967972c0f63d5cb871d98e8af09117 @trptcolin trptcolin committed Mar 24, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/clj/reply/initialization.clj
@@ -3,8 +3,9 @@
[clojure.repl]))
(defmacro repl-defn [sym & args]
- (let [no-meta-source (with-out-str (clojure.pprint/pprint `(defn ~sym ~@args)))
- meta-source `(clojure.core/defn ~(with-meta sym {:source no-meta-source}) ~@args)]
+ (let [no-meta-source (binding [*print-meta* true]
+ (with-out-str (clojure.pprint/pprint `(defn ~sym ~@args))))
+ meta-source `(clojure.core/defn ~(vary-meta sym assoc :source no-meta-source) ~@args)]
meta-source))
(defmacro sourcery [name]

0 comments on commit 04f8f0c

Please sign in to comment.