Commits

Moritz Heidkamp committed b5bf13f

add autoloading to clojure-namespace-ref

Comments (0)

Files changed (1)

   (make-hash-table))
 
 (define (module-ref name)
-  (or (##sys#find-module (##sys#resolve-module-name name #f) #f)
+  (or (##sys#find-module (##sys#resolve-module-name name 'module-ref) #f)
+      (condition-case (require name)
+        (exn ()
+             (if (and (eq? 'require (get-condition-property exn 'exn 'location))
+                      (equal? (list name) (get-condition-property exn 'exn 'arguments)))
+                 #f
+                 (signal exn))))
       (let ((mod (##sys#current-module)))
         (##sys#switch-module #f)
         (eval `(module ,name ()
           (##sys#switch-module mod)))))
 
 (define (clojure-eval expr)
+  (unless (current-namespace)
+    (current-namespace (clojure-namespace-ref 'user 'clojure-user)))
+
   (with-current-namespace
    (lambda ()
      (let ((res (eval (compile expr))))