Fix #112: Do not suppress messages from ftplugin

This commit is contained in:
Junegunn Choi 2014-10-19 14:45:19 +09:00
parent 4b3fbd1592
commit 0263370bd1
5 changed files with 61 additions and 33 deletions

View File

@ -315,7 +315,7 @@ function! plug#load(...)
for name in a:000 for name in a:000
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
endfor endfor
silent! doautocmd BufRead doautocmd BufRead
return 1 return 1
endfunction endfunction
@ -336,8 +336,8 @@ endfunction
function! s:lod_ft(pat, names) function! s:lod_ft(pat, names)
call s:lod(a:names, ['plugin', 'after/plugin']) call s:lod(a:names, ['plugin', 'after/plugin'])
execute 'autocmd! PlugLOD FileType' a:pat execute 'autocmd! PlugLOD FileType' a:pat
silent! doautocmd filetypeplugin FileType doautocmd filetypeplugin FileType
silent! doautocmd filetypeindent FileType doautocmd filetypeindent FileType
endfunction endfunction
function! s:lod_cmd(cmd, bang, l1, l2, args, name) function! s:lod_cmd(cmd, bang, l1, l2, args, name)

5
test/fixtures/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
fzf*
xxx
yyy
z1
z2

View File

@ -0,0 +1 @@
echomsg 'ftplugin'

View File

@ -5,18 +5,20 @@ cd ..
PLUG_SRC=$(pwd)/plug.vim PLUG_SRC=$(pwd)/plug.vim
cd - > /dev/null cd - > /dev/null
export PLUG_FIXTURES=$(pwd)/fixtures
if [ ! -d vader.vim ]; then if [ ! -d vader.vim ]; then
git clone https://github.com/junegunn/vader.vim.git git clone https://github.com/junegunn/vader.vim.git
fi fi
rm -rf fzf rm -rf $PLUG_FIXTURES/fzf
if [ ! -d fzf-staged ]; then if [ ! -d fzf-staged ]; then
git clone https://github.com/junegunn/fzf.git fzf-staged git clone https://github.com/junegunn/fzf.git $PLUG_FIXTURES/fzf-staged
fi fi
make_dirs() { make_dirs() {
mkdir -p "temp/$1" mkdir -p "$PLUG_FIXTURES/$1"
cd "temp/$1" cd "$PLUG_FIXTURES/$1"
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
for d in *; do for d in *; do
[ -d $d ] || continue [ -d $d ] || continue
@ -33,12 +35,12 @@ EOF
} }
init() { init() {
rm -rf temp/{xxx,yyy,z1,z2} rm -rf $PLUG_FIXTURES/{xxx,yyy,z1,z2}
make_dirs xxx/ xxx make_dirs xxx/ xxx
make_dirs xxx/after xxx make_dirs xxx/after xxx
mkdir -p temp/xxx/doc mkdir -p $PLUG_FIXTURES/xxx/doc
cat > temp/xxx/doc/xxx.txt << DOC cat > $PLUG_FIXTURES/xxx/doc/xxx.txt << DOC
hello *xxx* hello *xxx*
DOC DOC

View File

@ -421,7 +421,7 @@ Execute (On-demand loading based on filetypes):
********************************************************************** **********************************************************************
Execute (Add unmanaged plugin): Execute (Add unmanaged plugin):
let fzf = fnamemodify(g:vader_file, ':h') . '/fzf' let fzf = expand('$PLUG_FIXTURES/fzf')
Log fzf Log fzf
call plug#begin() call plug#begin()
@ -479,7 +479,7 @@ Execute (PlugStatus should point out that the plugin is missing):
Execute (Deploy unmanaged plugin): Execute (Deploy unmanaged plugin):
Assert !exists(':FZF'), ':FZF command should not exist' Assert !exists(':FZF'), ':FZF command should not exist'
call rename('fzf-staged', 'fzf') call rename(expand('$PLUG_FIXTURES/fzf-staged'), fzf)
Execute (PlugUpdate still should not care): Execute (PlugUpdate still should not care):
PlugUpdate PlugUpdate
@ -732,12 +732,12 @@ Execute (Using custom dir):
********************************************************************** **********************************************************************
Before (Clear global vars): Before (Clear global vars):
let g:xxx = [] let g:xxx = []
set rtp-=$PWD/temp/xxx/ set rtp-=$PLUG_FIXTURES/xxx/
set rtp-=$PWD/temp/xxx/after set rtp-=$PLUG_FIXTURES/xxx/after
Execute (Immediate loading): Execute (Immediate loading):
call plug#begin() call plug#begin()
Plug '$PWD/temp/xxx' Plug '$PLUG_FIXTURES/xxx'
call plug#end() call plug#end()
" FIXME: " FIXME:
@ -751,7 +751,7 @@ Execute (Immediate loading):
Execute (Command-based on-demand loading): Execute (Command-based on-demand loading):
call plug#begin() call plug#begin()
Plug '$PWD/temp/xxx', { 'on': 'XXX' } Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
call plug#end() call plug#end()
AssertEqual [], g:xxx AssertEqual [], g:xxx
@ -764,7 +764,7 @@ Execute (Command-based on-demand loading):
Execute (Filetype-based on-demand loading): Execute (Filetype-based on-demand loading):
call plug#begin() call plug#begin()
Plug '$PWD/temp/xxx', { 'for': 'xxx' } Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
call plug#end() call plug#end()
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
@ -779,10 +779,10 @@ Before:
********************************************************************** **********************************************************************
Execute (plug#helptags): Execute (plug#helptags):
silent! call delete(expand('$PWD/temp/xxx/doc/tags')) silent! call delete(expand('$PLUG_FIXTURES/xxx/doc/tags'))
Assert !filereadable(expand('$PWD/temp/xxx/doc/tags')) Assert !filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
AssertEqual 1, plug#helptags() AssertEqual 1, plug#helptags()
Assert filereadable(expand('$PWD/temp/xxx/doc/tags')) Assert filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
********************************************************************** **********************************************************************
~ Manual loading ~ Manual loading
@ -823,7 +823,7 @@ Execute (PlugStatus should not contain (not loaded)):
Execute (Load plugin from PlugStatus screen with L key in normal mode): Execute (Load plugin from PlugStatus screen with L key in normal mode):
call plug#begin() call plug#begin()
Plug '$PWD/temp/yyy', { 'on': [] } Plug '$PLUG_FIXTURES/yyy', { 'on': [] }
call plug#end() call plug#end()
PlugStatus PlugStatus
@ -837,8 +837,8 @@ Execute (Load plugin from PlugStatus screen with L key in normal mode):
Execute (Load plugin from PlugStatus screen with L key in visual mode): Execute (Load plugin from PlugStatus screen with L key in visual mode):
call plug#begin() call plug#begin()
Plug '$PWD/temp/z1', { 'on': [] } Plug '$PLUG_FIXTURES/z1', { 'on': [] }
Plug '$PWD/temp/z2', { 'for': [] } Plug '$PLUG_FIXTURES/z2', { 'for': [] }
call plug#end() call plug#end()
PlugStatus PlugStatus
@ -964,8 +964,8 @@ Execute (Plug directory with comma):
Execute (Strict load order): Execute (Strict load order):
let g:total_order = [] let g:total_order = []
call plug#begin() call plug#begin()
Plug '$PWD/temp/xxx' Plug '$PLUG_FIXTURES/xxx'
Plug '$PWD/temp/yyy', { 'for': ['xxx'] } Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
call plug#end() call plug#end()
call EnsureLoaded() call EnsureLoaded()
setf xxx setf xxx
@ -977,8 +977,8 @@ Execute (Strict load order):
let g:total_order = [] let g:total_order = []
call plug#begin() call plug#begin()
Plug '$PWD/temp/xxx', { 'for': ['xxx'] } Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
Plug '$PWD/temp/yyy' Plug '$PLUG_FIXTURES/yyy'
call plug#end() call plug#end()
call EnsureLoaded() call EnsureLoaded()
set rtp^=manually-prepended set rtp^=manually-prepended
@ -994,8 +994,8 @@ Execute (Strict load order):
let g:total_order = [] let g:total_order = []
call plug#begin() call plug#begin()
Plug '$PWD/temp/xxx', { 'for': ['xxx'] } Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
Plug '$PWD/temp/yyy', { 'for': ['xxx'] } Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
call plug#end() call plug#end()
call EnsureLoaded() call EnsureLoaded()
setf xxx setf xxx
@ -1007,9 +1007,11 @@ Execute (Strict load order):
********************************************************************** **********************************************************************
Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home): Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home):
call plug#begin('$PWD/temp') call plug#begin('$PLUG_FIXTURES')
Plug '$PWD/temp/xxx' Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': [] }
Plug '$PWD/temp/yyy' Plug '$PLUG_FIXTURES/fzf'
Plug '$PLUG_FIXTURES/xxx'
Plug '$PLUG_FIXTURES/yyy'
call plug#end() call plug#end()
" Remove z1, z2 " Remove z1, z2
@ -1022,6 +1024,24 @@ Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home
AssertExpect 'Already clean', 1 AssertExpect 'Already clean', 1
q q
**********************************************************************
Execute (#112 On-demand loading should not suppress messages from ftplugin):
call plug#begin('$PLUG_FIXTURES')
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
call plug#end()
redir => out
tabnew a.c
redir END
Assert stridx(out, 'ftplugin') >= 0
* The same applies to plug#load())
redir => out
call plug#load('ftplugin-msg')
redir END
Assert stridx(out, 'ftplugin') >= 0
q
********************************************************************** **********************************************************************
Execute (PlugSnapshot): Execute (PlugSnapshot):
call plug#begin('$TMPDIR/plugged') call plug#begin('$TMPDIR/plugged')
@ -1047,7 +1067,7 @@ Execute (PlugSnapshot):
Execute (Cleanup): Execute (Cleanup):
silent! call system('rm -rf '.temp_plugged) silent! call system('rm -rf '.temp_plugged)
silent! call system('rm -rf '.temp_plugged) silent! call system('rm -rf '.temp_plugged)
silent! call rename('fzf', 'fzf-staged') silent! call rename(fzf, expand('$PLUG_FIXTURES/fzf-staged'))
silent! unlet g:plugs silent! unlet g:plugs
silent! unlet g:plug_home silent! unlet g:plug_home
silent! unlet g:plug_url_format silent! unlet g:plug_url_format