Throw error if requiring doesn't load namespace

References #2.
This commit is contained in:
Tim Pope 2012-12-04 20:15:33 -05:00
parent a5bc4b0b44
commit 208f549664

View File

@ -135,12 +135,13 @@ function! s:repl.eval(expr, ns) dict abort
endfunction
function! s:repl.require(lib) dict abort
if a:lib =~# '^\%(user\)\=$' || has_key(self.requires, a:lib)
return ''
if a:lib !~# '^\%(user\)\=$' && !get(self.requires, a:lib, 0)
let reload = has_key(self.requires, a:lib) ? ' :reload' : ''
let self.requires[a:lib] = 0
call self.eval('(doto '.s:qsym(a:lib).' (require'.reload.') the-ns)', 'user')
let self.requires[a:lib] = 1
endif
let result = self.eval('(require '.s:qsym(a:lib).')', 'user')
let self.requires[a:lib] = 1
return result
return ''
endfunction
function! s:repl.includes_file(file) dict abort