Neovim: Fix various bits in ':CheckHealth', including detection of Python.

Issue found by tb@ when the ${LOCALBASE}/bin/python symlink is not existing.
Upstream fixed a couple of other bugs in the same PR. Thanks all.

OK tb@
This commit is contained in:
edd 2017-05-12 09:56:33 +00:00
parent 63c50cb10e
commit 49fe59f30e
3 changed files with 86 additions and 1 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.1.1.1 2017/05/02 20:58:42 edd Exp $
# $OpenBSD: Makefile,v 1.2 2017/05/12 09:56:33 edd Exp $
COMMENT = a continuation and extension of Vim
GH_ACCOUNT = neovim
GH_PROJECT = neovim
GH_TAGNAME = v0.2.0
REVISION = 0
CATEGORIES = editors devel
HOMEPAGE = http://neovim.org

View File

@ -0,0 +1,69 @@
$OpenBSD: patch-runtime_autoload_health_provider_vim,v 1.1 2017/05/12 09:56:34 edd Exp $
https://github.com/neovim/neovim/pull/6721
Index: runtime/autoload/health/provider.vim
--- runtime/autoload/health/provider.vim.orig
+++ runtime/autoload/health/provider.vim
@@ -38,6 +38,16 @@ function! s:system_handler(jobid, data, event) dict ab
endif
endfunction
+" Attempts to construct a shell command from an args list.
+" Only for display, to help users debug a failed command.
+function! s:shellify(cmd) abort
+ if type(a:cmd) != type([])
+ return a:cmd
+ endif
+ return join(map(copy(a:cmd),
+ \'v:val =~# ''\m[\-.a-zA-Z_/]'' ? shellescape(v:val) : v:val'), ' ')
+endfunction
+
" Run a system command and timeout after 30 seconds.
function! s:system(cmd, ...) abort
let stdin = a:0 ? a:1 : ''
@@ -54,8 +64,7 @@ function! s:system(cmd, ...) abort
let jobid = jobstart(a:cmd, opts)
if jobid < 1
- call health#report_error(printf('Command error %d: %s', jobid,
- \ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd))
+ call health#report_error(printf('Command error (job=%d): %s', jobid, s:shellify(a:cmd)))
let s:shell_error = 1
return opts.output
endif
@@ -66,13 +75,11 @@ function! s:system(cmd, ...) abort
let res = jobwait([jobid], 30000)
if res[0] == -1
- call health#report_error(printf('Command timed out: %s',
- \ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd))
+ call health#report_error(printf('Command timed out: %s', s:shellify(a:cmd)))
call jobstop(jobid)
elseif s:shell_error != 0 && !ignore_error
- call health#report_error(printf('Command error (%d) %s: %s', jobid,
- \ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd,
- \ opts.output))
+ call health#report_error(printf("Command error (job=%d): %s\nOutput: %s", jobid,
+ \ s:shellify(a:cmd), opts.output))
endif
return opts.output
@@ -157,7 +164,7 @@ function! s:version_info(python) abort
\ ]))
if empty(python_version)
- let python_version = 'unable to parse python response'
+ let python_version = 'unable to parse '.a:python.' response'
endif
let nvim_path = s:trim(s:system([
@@ -176,7 +183,7 @@ function! s:version_info(python) abort
endfunction
" Try to get neovim.VERSION (added in 0.1.11dev).
- let nvim_version = s:system(['python', '-c',
+ let nvim_version = s:system([a:python, '-c',
\ 'from neovim import VERSION as v; '.
\ 'print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))'],
\ '', 1, 1)

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-runtime_autoload_health_vim,v 1.1 2017/05/12 09:56:34 edd Exp $
https://github.com/neovim/neovim/pull/6721
Index: runtime/autoload/health.vim
--- runtime/autoload/health.vim.orig
+++ runtime/autoload/health.vim
@@ -66,6 +66,7 @@ function! health#check(plugin_names) abort
" needed for plasticboy/vim-markdown, because it uses fdm=expr
normal! zR
setlocal nomodified
+ setlocal bufhidden=hide
redraw|echo ''
endfunction