aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscgilardi <scgilardi@gmail.com>2009-08-24 00:52:02 -0400
committerscgilardi <scgilardi@gmail.com>2009-08-24 00:52:02 -0400
commit3a220e3af24bd5bd30869a112c7210a888ea6dc4 (patch)
treedb0da98b6cc071971f120634f7da421cfff849ad
parent04666031b885d8e9553e242ea704e4a921accf5b (diff)
modify immigrate to operate on root bindings rather than current bindings
-rw-r--r--src/clojure/contrib/ns_utils.clj24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/clojure/contrib/ns_utils.clj b/src/clojure/contrib/ns_utils.clj
index 0d9075a9..d77b3217 100644
--- a/src/clojure/contrib/ns_utils.clj
+++ b/src/clojure/contrib/ns_utils.clj
@@ -92,15 +92,15 @@
`(print-docs (get-ns '~nsname)))
(defn immigrate
- "Create a public var in this namespace for each public var in the
- namespaces named by ns-names. The created vars have the same name, value,
- and metadata as the original except that their :ns metadata value is this
- namespace."
- [& ns-names]
- (doseq [ns ns-names]
- (require ns)
- (doseq [[sym var] (ns-publics ns)]
- (let [sym (with-meta sym (assoc (meta var) :ns *ns*))]
- (if (.isBound var)
- (intern *ns* sym (var-get var))
- (intern *ns* sym))))))
+ "Create a public var in this namespace for each public var in the
+ namespaces named by ns-names. The created vars have the same name, root
+ binding, and metadata as the original except that their :ns metadata
+ value is this namespace."
+ [& ns-names]
+ (doseq [ns ns-names]
+ (require ns)
+ (doseq [[sym var] (ns-publics ns)]
+ (let [sym (with-meta sym (assoc (meta var) :ns *ns*))]
+ (if (.hasRoot var)
+ (intern *ns* sym (.getRoot var))
+ (intern *ns* sym))))))