Better extraction of ns form

Goal: not require class path at all.
This commit is contained in:
Tim Pope 2013-01-03 18:45:30 -05:00
parent 1d51636fa1
commit 3fa8d8396f

View File

@ -819,7 +819,10 @@ function! foreplay#ns() abort
while lnum < line('$') && getline(lnum) =~# '^\s*\%(;.*\)\=$'
let lnum += 1
endwhile
let ns = matchstr(getline(lnum), '\C^(\s*\%(in-ns\s*''\|ns\s\+\)\zs[A-Za-z0-9_?*!+/=<>.-]\+\ze')
let lines = join(getline(lnum, lnum+10), ' ')
let lines = substitute(lines, '"\%(\\.\|[^"]\)*"', '', 'g')
let lines = substitute(lines, '\^\={[^{}]*}', '', '')
let ns = matchstr(lines, '\C^(\s*\%(in-ns\s*''\|ns\s\+\)\zs[A-Za-z0-9_?*!+/=<>.-]\+\ze')
if ns !=# ''
return ns
endif