Tentatively drop support for session eval without REPL

I'm not 100% committed to this, but lets see if anyone even misses it
(including me).  My main use case for the one-off runner is jump to
source.
This commit is contained in:
Tim Pope 2014-04-03 19:36:10 -04:00
parent 095ee57d12
commit ab6d9db216
2 changed files with 13 additions and 11 deletions

View File

@ -41,10 +41,10 @@ The only external dependency is that you have either a Vim with Python support
compiled in, or `python` in your path.
Oh, and if you don't have an nREPL connection, installing [classpath.vim][]
lets it fall back to using `java clojure.main`, using a class path based on
your Leiningen or Maven config. It's a bit slow, but a two-second delay is
vastly preferable to being forced out of my flow for a single command, in my
book.
lets it fall back to using `java clojure.main` for some of the basics, using a
class path based on your Leiningen or Maven config. It's a bit slow, but a
two-second delay is vastly preferable to being forced out of my flow for a
single command, in my book.
[Piggieback]: https://github.com/cemerick/piggieback
[classpath.vim]: https://github.com/tpope/vim-classpath

View File

@ -388,16 +388,14 @@ function! s:oneoff.path() dict abort
endfunction
function! s:oneoff.eval(expr, options) dict abort
if &verbose && !empty(get(a:options, 'session', 1))
echohl WarningMSG
echomsg "No REPL found. Running java clojure.main ..."
echohl None
if !empty(get(a:options, 'session', 1))
throw 'Fireplace: no live REPL connection'
endif
return s:spawning_eval(self.classpath, a:expr, get(a:options, 'ns', self.user_ns()))
endfunction
function! s:oneoff.message(...) abort
throw 'No live REPL connection'
throw 'Fireplace: no live REPL connection'
endfunction
let s:oneoff.piggieback = s:oneoff.message
@ -459,7 +457,7 @@ function! fireplace#platform(...) abort
let cp = classpath#from_vim(getbufvar(buf, '&path'))
return extend({'classpath': cp, 'nr': bufnr(buf)}, s:oneoff)
endif
throw ':Connect to a REPL or install classpath.vim to evaluate code'
throw 'Fireplace: :Connect to a REPL or install classpath.vim'
endfunction
function! fireplace#client(...) abort
@ -467,7 +465,7 @@ function! fireplace#client(...) abort
let client = fireplace#platform(buf)
if fnamemodify(bufname(buf), ':e') ==# 'cljs'
if !has_key(client, 'connection')
throw ':Connect to a REPL to evaluate code'
throw 'Fireplace: no live REPL connection'
endif
if empty(client.piggiebacks)
let result = client.piggieback('')
@ -643,6 +641,10 @@ function! fireplace#echo_session_eval(expr, ...) abort
try
echo fireplace#session_eval(a:expr, a:0 ? a:1 : {})
catch /^Clojure:/
catch
echohl ErrorMSG
echomsg v:exception
echohl NONE
endtry
return ''
endfunction