Allow forcing default ns

This commit is contained in:
Tim Pope 2014-10-23 15:39:01 -04:00
parent 97758acc16
commit 8f7a07cffd

View File

@ -156,7 +156,7 @@ function! s:nrepl_eval(expr, ...) dict abort
throw 'Clojure: Interrupt' throw 'Clojure: Interrupt'
endif endif
endtry endtry
if has_key(response, 'ns') && !has_key(options, 'ns') if has_key(response, 'ns') && empty(get(options, 'ns'))
let self.ns = response.ns let self.ns = response.ns
endif endif
@ -198,6 +198,9 @@ function! s:nrepl_prepare(msg) dict abort
if !has_key(msg, 'id') if !has_key(msg, 'id')
let msg.id = fireplace#nrepl#next_id() let msg.id = fireplace#nrepl#next_id()
endif endif
if empty(get(msg, 'ns', 1))
unlet msg.ns
endif
if empty(get(msg, 'session', 1)) if empty(get(msg, 'session', 1))
unlet msg.session unlet msg.session
elseif !has_key(msg, 'session') elseif !has_key(msg, 'session')