Merge pull request #239 from siphiuel/master

Change :Piggieback behavior for empty/port parameters
This commit is contained in:
Tim Pope 2015-10-02 12:12:42 -04:00
commit 8579a41a18

View File

@ -277,15 +277,19 @@ function! s:repl.piggieback(arg, ...) abort
let connection = s:conn_try(self.connection, 'clone') let connection = s:conn_try(self.connection, 'clone')
if empty(a:arg) if empty(a:arg)
let arg = '' let arg = '(cljs.repl.rhino/repl-env)'
elseif a:arg =~# '^\d\{1,5}$' elseif a:arg =~# '^\d\{1,5}$'
call connection.eval("(require 'cljs.repl.browser)") let replns = 'weasel.repl.websocket'
if has_key(connection.eval("(require '" . replns . ")"), 'ex')
let replns = 'cljs.repl.browser'
call connection.eval("(require '" . replns . ")")
endif
let port = matchstr(a:arg, '^\d\{1,5}$') let port = matchstr(a:arg, '^\d\{1,5}$')
let arg = ' (cljs.repl.browser/repl-env :port '.port.')' let arg = '('.replns.'/repl-env :port '.port.')'
else else
let arg = ' ' . a:arg let arg = a:arg
endif endif
let response = connection.eval('(cemerick.piggieback/cljs-repl'.arg.')') let response = connection.eval('(cemerick.piggieback/cljs-repl'.' '.arg.')')
if empty(get(response, 'ex')) if empty(get(response, 'ex'))
call insert(self.piggiebacks, extend({'connection': connection}, deepcopy(s:piggieback))) call insert(self.piggiebacks, extend({'connection': connection}, deepcopy(s:piggieback)))