Skip to content

Commit e54d6e6

Browse files
committed
Fix qf_list
1 parent bb62fdc commit e54d6e6

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

autoload/pymode/lint.vim

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,26 @@ function! pymode#lint#Check()
44
try
55
write
66
catch /E212/
7-
echohl Error | echo "File modified and I can't save it. PyLint cancel." | echohl None
7+
echohl Error | echo "File modified and I can't save it. Cancel code checking." | echohl None
88
return 0
99
endtry
1010
endif
1111

1212
py check_file()
1313

14-
if len(b:qf_list) || (exists('b:errors') && len(b:errors))
14+
if g:qf_list != b:qf_list
1515

1616
call setqflist(b:qf_list, 'r')
1717

18+
let g:qf_list = b:qf_list
19+
1820
if g:pymode_lint_cwindow
1921
call pymode#QuickfixOpen(0, g:pymode_lint_hold, g:pymode_lint_maxheight, g:pymode_lint_minheight, g:pymode_lint_jump)
2022
endif
2123

2224
endif
2325

2426
if g:pymode_lint_message
25-
let b:errors = {}
2627
for v in b:qf_list
2728
let b:errors[v['lnum']] = v['text']
2829
endfor
@@ -35,21 +36,25 @@ function! pymode#lint#Check()
3536

3637
endfunction
3738

39+
3840
fun! pymode#lint#Toggle() "{{{
3941
let g:pymode_lint = g:pymode_lint ? 0 : 1
4042
call pymode#lint#toggle_win(g:pymode_lint, "Pymode lint")
4143
endfunction "}}}
4244

45+
4346
fun! pymode#lint#ToggleWindow() "{{{
4447
let g:pymode_lint_cwindow = g:pymode_lint_cwindow ? 0 : 1
4548
call pymode#lint#toggle_win(g:pymode_lint_cwindow, "Pymode lint cwindow")
4649
endfunction "}}}
4750

51+
4852
fun! pymode#lint#ToggleChecker() "{{{
4953
let g:pymode_lint_checker = g:pymode_lint_checker == "pylint" ? "pyflakes" : "pylint"
5054
echomsg "Pymode lint checker: " . g:pymode_lint_checker
5155
endfunction "}}}
5256

57+
5358
fun! pymode#lint#toggle_win(toggle, msg) "{{{
5459
if a:toggle
5560
echomsg a:msg." enabled"
@@ -63,11 +68,10 @@ fun! pymode#lint#toggle_win(toggle, msg) "{{{
6368
endif
6469
endfunction "}}}
6570

71+
6672
fun! pymode#lint#show_errormessage() "{{{
73+
if !len(b:errors) | return | endif
6774
let cursor = getpos(".")
68-
if !pymode#Default('b:errors', {}) || !len(b:errors)
69-
return
70-
endif
7175
if has_key(b:errors, l:cursor[1])
7276
call pymode#WideMessage(b:errors[l:cursor[1]])
7377
let b:show_message = 1

ftplugin/python/pymode.vim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ endif
6363

6464
if g:pymode_lint
6565

66-
" DESC: Show message flag
67-
let b:show_message = 0
66+
let b:qf_list = []
6867

6968
" DESC: Set commands
7069
command! -buffer -nargs=0 PyLintToggle :call pymode#lint#Toggle()
@@ -82,6 +81,13 @@ if g:pymode_lint
8281
endif
8382

8483
if g:pymode_lint_message
84+
85+
" DESC: Show message flag
86+
let b:show_message = 0
87+
88+
" DESC: Errors dict
89+
let b:errors = {}
90+
8591
au CursorHold <buffer> call pymode#lint#show_errormessage()
8692
au CursorMoved <buffer> call pymode#lint#show_errormessage()
8793
endif

plugin/pymode.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ endif
5151

5252
if !pymode#Default("g:pymode_lint", 1) || g:pymode_lint
5353

54+
let g:qf_list = []
55+
5456
" OPTION: g:pymode_lint_write -- bool. Check code every save.
5557
call pymode#Default("g:pymode_lint_write", 1)
5658

0 commit comments

Comments
 (0)