Expose fireplace#register_port_file

References #121.
This commit is contained in:
Tim Pope 2014-04-10 23:25:59 -04:00
parent ea1012e1be
commit 2dec3b49b2

View File

@ -240,7 +240,7 @@ function! s:unregister_connection(conn) abort
call filter(s:repl_portfiles, 'v:val.connection.transport isnot# a:conn.transport') call filter(s:repl_portfiles, 'v:val.connection.transport isnot# a:conn.transport')
endfunction endfunction
function! s:register_portfile(portfile, ...) abort function! fireplace#register_port_file(portfile, ...) abort
let old = get(s:repl_portfiles, a:portfile, {}) let old = get(s:repl_portfiles, a:portfile, {})
if has_key(old, 'time') && getftime(a:portfile) !=# old.time if has_key(old, 'time') && getftime(a:portfile) !=# old.time
call s:unregister_connection(old.connection) call s:unregister_connection(old.connection)
@ -486,7 +486,7 @@ function! fireplace#platform(...) abort
let portfile = findfile('.nrepl-port', '.;') let portfile = findfile('.nrepl-port', '.;')
if !empty(portfile) if !empty(portfile)
call s:register_portfile(portfile, fnamemodify(portfile, ':h')) call fireplace#register_port_file(portfile, fnamemodify(portfile, ':h'))
endif endif
silent doautocmd User FireplacePreConnect silent doautocmd User FireplacePreConnect
@ -1495,7 +1495,7 @@ function! s:leiningen_connect(auto) abort
if empty(portfile) if empty(portfile)
return return
endif endif
let conn = s:register_portfile(portfile, b:leiningen_root) let conn = fireplace#register_port_file(portfile, b:leiningen_root)
if has_key(conn, 'path') if has_key(conn, 'path')
let s:leiningen_paths[b:leiningen_root] = conn.path() let s:leiningen_paths[b:leiningen_root] = conn.path()
endif endif