From 602e7fa00f50de2af3a35e1cc0a536be07947d5a Mon Sep 17 00:00:00 2001 From: w0rp Date: Tue, 3 Jul 2018 21:14:00 +0100 Subject: #1524 Avoid loading cursor code until engine code has been loaded --- autoload/ale/events.vim | 4 ++-- test/test_autocmd_commands.vader | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/autoload/ale/events.vim b/autoload/ale/events.vim index 44ef4b7a..4bc5cde1 100644 --- a/autoload/ale/events.vim +++ b/autoload/ale/events.vim @@ -122,11 +122,11 @@ function! ale#events#Init() abort endif if g:ale_echo_cursor - autocmd CursorMoved,CursorHold * call ale#cursor#EchoCursorWarningWithDelay() + autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarningWithDelay() | endif " Look for a warning to echo as soon as we leave Insert mode. " The script's position variable used when moving the cursor will " not be changed here. - autocmd InsertLeave * call ale#cursor#EchoCursorWarning() + autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif endif endif augroup END diff --git a/test/test_autocmd_commands.vader b/test/test_autocmd_commands.vader index 01646606..5b48be99 100644 --- a/test/test_autocmd_commands.vader +++ b/test/test_autocmd_commands.vader @@ -85,12 +85,12 @@ Execute (All events should be set up when everything is on): \ 'BufReadPost call ale#Queue(0, ''lint_file'', str2nr(expand('''')))', \ 'BufWinEnter * call ale#Queue(0, ''lint_file'', str2nr(expand('''')))', \ 'BufWritePost * call ale#events#SaveEvent(str2nr(expand('''')))', - \ 'CursorHold * call ale#cursor#EchoCursorWarningWithDelay()', - \ 'CursorMoved * call ale#cursor#EchoCursorWarningWithDelay()', + \ 'CursorHold * if exists(''*ale#engine#Cleanup'') | call ale#cursor#EchoCursorWarningWithDelay() | endif', + \ 'CursorMoved * if exists(''*ale#engine#Cleanup'') | call ale#cursor#EchoCursorWarningWithDelay() | endif', \ 'FileChangedShellPost * call ale#events#FileChangedEvent(str2nr(expand('''')))', \ 'FileType * call ale#events#FileTypeEvent( str2nr(expand('''')), expand(''''))', \ 'InsertLeave * call ale#Queue(0)', - \ 'InsertLeave call ale#cursor#EchoCursorWarning()', + \ 'InsertLeave if exists(''*ale#engine#Cleanup'') | call ale#cursor#EchoCursorWarning() | endif', \ 'TextChanged * call ale#Queue(g:ale_lint_delay)', \ 'TextChangedI * call ale#Queue(g:ale_lint_delay)', \ ], -- cgit v1.2.3