Skip to content

Commit 0e1b191

Browse files
authored
Check if TestFiletypeFuncs exists before defining it (#788)
Fixes #783
1 parent 83422e0 commit 0e1b191

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

extras/filetype.vim

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,17 +2506,20 @@ endif
25062506
" Function called for testing all functions defined here. These are
25072507
" script-local, thus need to be executed here.
25082508
" Returns a string with error messages (hopefully empty).
2509-
func! TestFiletypeFuncs(testlist)
2510-
let output = ''
2511-
for f in a:testlist
2512-
try
2513-
exe f
2514-
catch
2515-
let output = output . "\n" . f . ": " . v:exception
2516-
endtry
2517-
endfor
2518-
return output
2519-
endfunc
2509+
" Check if function exists first. See https://github.com/vim/vim/issues/9890
2510+
if !exists("*TestFiletypeFuncs")
2511+
func! TestFiletypeFuncs(testlist)
2512+
let output = ''
2513+
for f in a:testlist
2514+
try
2515+
exe f
2516+
catch
2517+
let output = output . "\n" . f . ": " . v:exception
2518+
endtry
2519+
endfor
2520+
return output
2521+
endfunc
2522+
endif
25202523

25212524
" Restore 'cpoptions'
25222525
let &cpo = s:cpo_save

0 commit comments

Comments
 (0)