Use user ns to avoid qualification

This commit is contained in:
Tim Pope 2014-04-12 20:38:33 -04:00
parent 9e826faff4
commit 238b526cf2
2 changed files with 8 additions and 8 deletions

View File

@ -156,11 +156,11 @@ function! s:nrepl_eval(expr, ...) dict abort
endfunction
function! s:extract_last_stacktrace(nrepl) abort
let format_st = '(clojure.core/symbol (clojure.core/str "\n\b" (clojure.core/apply clojure.core/str (clojure.core/interleave (clojure.core/repeat "\n") (clojure.core/map clojure.core/str (.getStackTrace *e)))) "\n\b\n"))'
let stacktrace = split(get(split(a:nrepl.process({'op': 'eval', 'code': '['.format_st.' *3 *2 *1]', 'session': a:nrepl.session}).value[0], "\n\b\n"), 1, ""), "\n")
call a:nrepl.message({'op': 'eval', 'code': '(*1 1)', 'session': a:nrepl.session})
call a:nrepl.message({'op': 'eval', 'code': '(*2 2)', 'session': a:nrepl.session})
call a:nrepl.message({'op': 'eval', 'code': '(*3 3)', 'session': a:nrepl.session})
let format_st = '(symbol (str "\n\b" (apply str (interleave (repeat "\n") (map str (.getStackTrace *e)))) "\n\b\n"))'
let stacktrace = split(get(split(a:nrepl.process({'op': 'eval', 'code': '['.format_st.' *3 *2 *1]', 'ns': 'user', 'session': a:nrepl.session}).value[0], "\n\b\n"), 1, ""), "\n")
call a:nrepl.message({'op': 'eval', 'code': '(*1 1)', 'ns': 'user', 'session': a:nrepl.session})
call a:nrepl.message({'op': 'eval', 'code': '(*2 2)', 'ns': 'user', 'session': a:nrepl.session})
call a:nrepl.message({'op': 'eval', 'code': '(*3 3)', 'ns': 'user', 'session': a:nrepl.session})
return stacktrace
endfunction

View File

@ -1070,13 +1070,13 @@ function! s:Require(bang, echo, ns) abort
if expand('%:e') ==# 'cljs'
let cmd = '(load-file '.s:str(tr(a:ns ==# '' ? fireplace#ns() : a:ns, '-.', '_/').'.cljs').')'
else
let cmd = ('(clojure.core/require '.s:qsym(a:ns ==# '' ? fireplace#ns() : a:ns).' :reload'.(a:bang ? '-all' : '').')')
let cmd = ('(require '.s:qsym(a:ns ==# '' ? fireplace#ns() : a:ns).' :reload'.(a:bang ? '-all' : '').')')
endif
if a:echo
echo cmd
endif
try
call fireplace#session_eval(cmd)
call fireplace#session_eval(cmd, {'ns': fireplace#client().user_ns()})
return ''
catch /^Clojure:.*/
return ''
@ -1349,7 +1349,7 @@ function! fireplace#capture_test_run(expr) abort
\ . ' ((.getRawRoot #''clojure.test/report) m)))]'
\ . ' ' . a:expr . ')'
let qflist = []
let response = s:eval(expr, {'session': 0})
let response = s:eval(expr, {'session': 0, 'ns': fireplace#client().user_ns()})
if !has_key(response, 'out')
return s:output_response(response)
endif