Skip to content

Commit

Permalink
Add awful hack to support broken namespaces
Browse files Browse the repository at this point in the history
This works around the fact that `load` (upon which `require` depends)
calls `remove-ns` if the first attempt to load an ns fails.
  • Loading branch information
trptcolin committed Jun 16, 2014
1 parent 83a317c commit a797eec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugin/fireplace.vim
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,12 @@ function! s:repl.preload(lib) dict abort
let self.requires[a:lib] = 0
let clone = s:conn_try(self.connection, 'clone')
try
let result = clone.eval('(ns '.self.user_ns().' (:require '.a:lib.reload.'))', {'ns': self.user_ns()})
let result = clone.eval("(#'clojure.core/load-one \"" . a:lib . "\" true true)", {'ns': self.user_ns()})
let ns_exists = clone.eval("(the-ns '" . a:lib . ")", {'ns': self.user_ns()})
finally
call clone.close()
endtry
let self.requires[a:lib] = !has_key(result, 'ex')
let self.requires[a:lib] = !has_key(ns_exists, 'ex')
if has_key(result, 'ex')
return result
endif
Expand Down

0 comments on commit a797eec

Please sign in to comment.