Skip to content

Commit d295a98

Browse files
committed
Merge branch 'release/0.7.2b'
2 parents 26bba03 + e70721f commit d295a98

File tree

20 files changed

+352
-97
lines changed

20 files changed

+352
-97
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ language: ruby
22
python: "2.7"
33
rvm:
44
- 1.9.3
5-
script: rake ci
5+
script:
6+
- make travis

Changelog.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Changelog
22
=========
33

4-
## 2013-12-01 0.7.1b
4+
## 2013-12-02 0.7.2b
55
--------------------
66
* Update indentation support;
77
* Python3 support;
@@ -21,18 +21,21 @@ Changelog
2121
'pymode_rope_enable_autoimport' -> 'pymode_rope_autoimport'
2222

2323
* Options removed:
24+
2425
'pymode_lint_hold', 'pymode_lint_config', 'pymode_lint_jump',
2526
'pymode_lint_signs_always_visible', 'pymode_rope_extended_complete',
2627
'pymode_rope_auto_project', 'pymode_rope_autoimport_generate',
2728
'pymode_rope_autoimport_underlines', 'pymode_rope_codeassist_maxfixes',
2829
'pymode_rope_sorted_completions', 'pymode_rope_extended_complete',
2930
'pymode_rope_confirm_saving', 'pymode_rope_global_prefix',
30-
'pymode_rope_local_prefix', 'pymode_rope_vim_completion', 'pymode_rope_guess_project',
31-
'pymode_rope_goto_def_newwin', 'pymode_rope_always_show_complete_menu'
31+
'pymode_rope_local_prefix', 'pymode_rope_vim_completion',
32+
'pymode_rope_guess_project', 'pymode_rope_goto_def_newwin',
33+
'pymode_rope_always_show_complete_menu'
3234

3335
* Options added:
34-
'pymode_rope_regenerate_on_write', 'pymode_rope_completion', 'pymode_rope_complete_on_dot',
35-
'pymode_lint_sort'
36+
'pymode_rope_regenerate_on_write', 'pymode_rope_completion',
37+
'pymode_rope_complete_on_dot', 'pymode_lint_sort',
38+
'pymode_rope_look_project', 'pymode_lint_unmodified'
3639

3740
* Commands added:
3841
'PymodeVirtualenv'

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ PYLAMA = $(LIBS)/pylama
66
clean:
77
find . -name "*.pyc" -delete
88

9+
# Temporary disable rope tests on Travis
10+
.PHONY: travis
11+
travis:
12+
rm -rf t/rope.vim
13+
rake test
14+
915
.PHONY: test
1016
test:
1117
bundle install
18+
rm -rf $(CURDIR)/.ropeproject
1219
rake test
1320

1421
.PHONY: pylama

README.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,16 @@ Then rebuild **helptags** in vim::
9898
Troubleshooting
9999
===============
100100

101-
If your python-mode doesn't work: open any python file and type: ::
101+
If your python-mode doesn't work:
102102

103-
:call pymode#troubleshooting#test()
103+
1. Load Vim with only python-mode enabled (use `debug.vim` from pymode): ::
104+
105+
vim -u <path_to_pymode>/debug.vim
106+
107+
And try to repeat your case. If no error occurs, seems like problem isnt in the
108+
plugin.
109+
110+
2. Type `:PymodeTroubleshooting`
104111

105112
And fix any warnings or copy the output and send it to me. (For example, by
106113
creating a `new github issue <https://github.com/klen/python-mode/issues/new>`_

autoload/pymode.vim

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ fun! pymode#save() "{{{
8686
try
8787
noautocmd write
8888
catch /E212/
89-
call pymode#error("File modified and I can't save it. Cancel code checking.")
89+
call pymode#error("File modified and I can't save it. Please save it manually.")
9090
return 0
9191
endtry
9292
endif
93-
return 1
93+
return expand('%') != ''
9494
endfunction "}}}
9595

9696
fun! pymode#reload_buf_by_nr(nr) "{{{
@@ -110,9 +110,18 @@ endfunction
110110

111111
fun! pymode#buffer_post_write() "{{{
112112
if b:pymode_modified && g:pymode_rope_regenerate_on_write
113+
call pymode#debug('regenerate')
113114
call pymode#rope#regenerate()
114115
endif
115-
if b:pymode_modified && g:pymode_lint_on_write
116+
if g:pymode_lint_unmodified || (g:pymode_lint_on_write && b:pymode_modified)
117+
call pymode#debug('check code')
116118
call pymode#lint#check()
117119
endif
118120
endfunction "}}}
121+
122+
fun! pymode#debug(msg) "{{{
123+
if g:pymode_debug
124+
let g:pymode_debug += 1
125+
echom string(g:pymode_debug) . ': ' . string(a:msg)
126+
endif
127+
endfunction "}}}

autoload/pymode/lint.vim

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
PymodePython from pymode.lint import code_check
22

3+
call pymode#tools#signs#init()
4+
call pymode#tools#loclist#init()
5+
6+
37
fun! pymode#lint#auto() "{{{
48
if !pymode#save()
59
return 0
@@ -13,7 +17,8 @@ endfunction "}}}
1317

1418

1519
fun! pymode#lint#show_errormessage() "{{{
16-
if empty(b:pymode_errors)
20+
let loclist = g:PymodeLocList.current()
21+
if loclist.is_empty()
1722
return
1823
endif
1924

@@ -22,8 +27,8 @@ fun! pymode#lint#show_errormessage() "{{{
2227
return
2328
endif
2429
let b:pymode_error_line = l
25-
if has_key(b:pymode_errors, l)
26-
call pymode#wide_message(b:pymode_errors[l])
30+
if has_key(loclist._messages, l)
31+
call pymode#wide_message(loclist._messages[l])
2732
else
2833
echo
2934
endif
@@ -39,47 +44,37 @@ fun! pymode#lint#toggle() "{{{
3944
end
4045
endfunction "}}}
4146

47+
4248
fun! pymode#lint#check() "{{{
4349
" DESC: Run checkers on current file.
4450
"
45-
if !g:pymode_lint | return | endif
51+
let loclist = g:PymodeLocList.current()
52+
53+
let b:pymode_error_line = -1
4654

47-
let b:pymode_errors = {}
55+
call loclist.clear()
4856

4957
call pymode#wide_message('Code checking is running ...')
5058

5159
PymodePython code_check()
5260

53-
let errors = getqflist()
54-
if empty(errors)
61+
if loclist.is_empty()
5562
call pymode#wide_message('Code checking is completed. No errors found.')
5663
endif
5764

65+
call g:PymodeSigns.refresh(loclist)
66+
5867
if g:pymode_lint_cwindow
68+
call setqflist(loclist._loclist)
5969
call pymode#quickfix_open(0, g:pymode_quickfix_maxheight, g:pymode_quickfix_minheight, 0)
6070
endif
6171

62-
if g:pymode_lint_signs
63-
for item in b:pymode_signs
64-
execute printf('sign unplace %d buffer=%d', item.lnum, item.bufnr)
65-
endfor
66-
let b:pymode_lint_signs = []
67-
for item in filter(errors, 'v:val.bufnr != ""')
68-
call add(b:pymode_signs, item)
69-
execute printf('sign place %d line=%d name=%s buffer=%d', item.lnum, item.lnum, "Pymode".item.type, item.bufnr)
70-
endfor
71-
endif
72-
73-
for item in errors
74-
let b:pymode_errors[item.lnum] = item.text
75-
endfor
76-
77-
let b:pymode_error_line = -1
7872
call pymode#lint#show_errormessage()
79-
call pymode#wide_message('Found errors and warnings: ' . len(errors))
73+
call pymode#wide_message('Found errors and warnings: ' . len(loclist._loclist))
8074

8175
endfunction " }}}
8276

77+
8378
fun! pymode#lint#tick_queue() "{{{
8479

8580
python import time
@@ -96,11 +91,13 @@ fun! pymode#lint#tick_queue() "{{{
9691
endif
9792
endfunction "}}}
9893

94+
9995
fun! pymode#lint#stop() "{{{
10096
au! pymode CursorHold <buffer>
101-
endfunction
97+
endfunction "}}}
98+
10299

103100
fun! pymode#lint#start() "{{{
104101
au! pymode CursorHold <buffer> call pymode#lint#tick_queue()
105102
call pymode#lint#tick_queue()
106-
endfunction
103+
endfunction "}}}

autoload/pymode/rope.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,6 @@ fun! pymode#rope#module_to_package() "{{{
161161
endfunction "}}}
162162

163163
fun! pymode#rope#autoimport(word) "{{{
164-
if !pymode#save()
165-
return 0
166-
endif
167164
PymodePython rope.autoimport()
168165
endfunction "}}}
169166

autoload/pymode/tools/loclist.vim

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
let g:PymodeLocList= {}
2+
3+
4+
fun! pymode#tools#loclist#init() "{{{
5+
return
6+
endfunction "}}}
7+
8+
9+
fun! g:PymodeLocList.init(raw_list) "{{{
10+
let obj = copy(self)
11+
let loc_list = filter(copy(a:raw_list), 'v:val["valid"] == 1')
12+
call obj.clear()
13+
return obj
14+
endfunction "}}}
15+
16+
17+
fun! g:PymodeLocList.current() "{{{
18+
if !exists("b:pymode_loclist")
19+
let b:pymode_loclist = g:PymodeLocList.init([])
20+
endif
21+
let b:pymode_loclist._bufnr = bufnr('.')
22+
return b:pymode_loclist
23+
endfunction "}}}
24+
25+
26+
fun! g:PymodeLocList.is_empty() "{{{
27+
return empty(self._loclist)
28+
endfunction "}}}
29+
30+
31+
fun! g:PymodeLocList.clear() "{{{
32+
let self._loclist = []
33+
let self._messages = {}
34+
let self._bufnr = bufnr('')
35+
endfunction "}}}
36+
37+
38+
fun! g:PymodeLocList.extend(raw_list) "{{{
39+
call extend(self._loclist, a:raw_list)
40+
for issue in a:raw_list
41+
let self._messages[issue.lnum] = issue.text
42+
endfor
43+
return self
44+
endfunction "}}}
45+
46+
47+
fun! g:PymodeLocList.filter(filters) "{{{
48+
let loclist = []
49+
for error in self._loclist
50+
let passes_filters = 1
51+
for key in keys(a:filters)
52+
if get(error, key, '') !=? a:filters[key]
53+
let passes_filters = 0
54+
break
55+
endif
56+
endfor
57+
58+
if passes_filters
59+
call add(loclist, error)
60+
endif
61+
62+
endfor
63+
return loclist
64+
endfunction "}}}

autoload/pymode/tools/signs.vim

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
let g:PymodeSigns = {}
2+
3+
4+
fun! pymode#tools#signs#init() "{{{
5+
call g:PymodeSigns.setup()
6+
endfunction "}}}
7+
8+
9+
fun! g:PymodeSigns.enabled() "{{{
10+
return (g:pymode_lint_signs && has('signs'))
11+
endfunction "}}}
12+
13+
14+
fun! g:PymodeSigns.setup() "{{{
15+
if self.enabled()
16+
execute 'sign define PymodeW text=' . g:pymode_lint_todo_symbol . " texthl=Todo"
17+
execute 'sign define PymodeC text=' . g:pymode_lint_comment_symbol . " texthl=Comment"
18+
execute 'sign define PymodeR text=' . g:pymode_lint_visual_symbol . " texthl=Visual"
19+
execute 'sign define PymodeE text=' . g:pymode_lint_error_symbol . " texthl=Error"
20+
execute 'sign define PymodeI text=' . g:pymode_lint_info_symbol . " texthl=Info"
21+
execute 'sign define PymodeF text=' . g:pymode_lint_pyflakes_symbol . " texthl=Info"
22+
endif
23+
let self._sign_ids = []
24+
let self._next_id = 10000
25+
let self._messages = {}
26+
endfunction "}}}
27+
28+
29+
fun! g:PymodeSigns.refresh(loclist) "{{{
30+
if self.enabled()
31+
call self.clear()
32+
call self.place(a:loclist)
33+
endif
34+
endfunction "}}}
35+
36+
37+
fun! g:PymodeSigns.clear() "{{{
38+
let ids = copy(self._sign_ids)
39+
for i in ids
40+
execute "sign unplace " . i
41+
call remove(self._sign_ids, index(self._sign_ids, i))
42+
endfor
43+
endfunction "}}}
44+
45+
46+
fun! g:PymodeSigns.place(loclist) "{{{
47+
let seen = {}
48+
for issue in a:loclist._loclist
49+
if !has_key(seen, issue.lnum)
50+
let seen[issue.lnum] = 1
51+
call add(self._sign_ids, self._next_id)
52+
execute printf('sign place %d line=%d name=%s buffer=%d', self._next_id, issue.lnum, "Pymode".issue.type[0], issue.bufnr)
53+
let self._next_id += 1
54+
endif
55+
endfor
56+
endfunction "}}}

debug.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
" Use this settings for testing the plugin.
2+
" Run vim with command
3+
"
4+
" $ vim -u debug.py
5+
"
6+
" Only python-mode will be loaded.
7+
8+
9+
execute('set rtp+='. expand('<sfile>:p:h'))
10+
set rtp -=$HOME/.vim
11+
set rtp -=$HOME/.vim/after
12+
set nocp
13+
syntax enable

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy