#734 - Use the buffer number from the events for entering buffers and saving buffers for checking buffers

This commit is contained in:
w0rp
2017-08-01 00:03:24 +01:00
parent ec82530247
commit a4ffd2f37c
8 changed files with 52 additions and 40 deletions

View File

@@ -66,7 +66,7 @@ function! s:StopCursorTimer() abort
endfunction
function! ale#cursor#EchoCursorWarning(...) abort
if ale#ShouldDoNothing()
if ale#ShouldDoNothing(bufnr(''))
return
endif
@@ -93,7 +93,7 @@ let s:cursor_timer = -1
let s:last_pos = [0, 0, 0]
function! ale#cursor#EchoCursorWarningWithDelay() abort
if ale#ShouldDoNothing()
if ale#ShouldDoNothing(bufnr(''))
return
endif
@@ -112,7 +112,7 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort
endfunction
function! ale#cursor#ShowCursorDetail() abort
if ale#ShouldDoNothing()
if ale#ShouldDoNothing(bufnr(''))
return
endif

View File

@@ -139,7 +139,7 @@ function! s:HandleLoclist(linter_name, buffer, loclist) abort
" for efficient lookup of the messages in the cursor handler.
call sort(g:ale_buffer_info[a:buffer].loclist, 'ale#util#LocItemCompare')
if ale#ShouldDoNothing()
if ale#ShouldDoNothing(a:buffer)
return
endif

View File

@@ -1,7 +1,7 @@
" Author: w0rp <devw0rp@gmail.com>
function! ale#events#SaveEvent() abort
let l:should_lint = g:ale_enabled && g:ale_lint_on_save
function! ale#events#SaveEvent(buffer) abort
let l:should_lint = ale#Var(a:buffer, 'enabled') && g:ale_lint_on_save
if g:ale_fix_on_save
let l:will_fix = ale#fix#Fix('save_file')
@@ -9,25 +9,27 @@ function! ale#events#SaveEvent() abort
endif
if l:should_lint
call ale#Queue(0, 'lint_file')
call ale#Queue(0, 'lint_file', a:buffer)
endif
endfunction
function! s:LintOnEnter() abort
if g:ale_enabled && g:ale_lint_on_enter && has_key(b:, 'ale_file_changed')
function! s:LintOnEnter(buffer) abort
if ale#Var(a:buffer, 'enabled')
\&& g:ale_lint_on_enter
\&& has_key(b:, 'ale_file_changed')
call remove(b:, 'ale_file_changed')
call ale#Queue(0, 'lint_file')
call ale#Queue(0, 'lint_file', a:buffer)
endif
endfunction
function! ale#events#EnterEvent() abort
call s:LintOnEnter()
function! ale#events#EnterEvent(buffer) abort
call s:LintOnEnter(a:buffer)
endfunction
function! ale#events#FileChangedEvent(buffer) abort
call setbufvar(a:buffer, 'ale_file_changed', 1)
if bufnr('') == a:buffer
call s:LintOnEnter()
call s:LintOnEnter(a:buffer)
endif
endfunction