Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6d497a4

Browse files
committed
changed troubleshooting mechanism and updated documentation on development guidelines
1 parent5a29192 commit6d497a4

File tree

11 files changed

+339
-303
lines changed

11 files changed

+339
-303
lines changed

‎autoload/pymode.vim

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ fun! pymode#trim_whitespaces() "{{{
7676
endif
7777
endfunction"}}}
7878

79-
8079
fun!pymode#save()"{{{
8180
if &modifiable&& &modified
8281
try
@@ -120,9 +119,25 @@ fun! pymode#buffer_post_write() "{{{
120119
endfunction"}}}
121120

122121
fun!pymode#debug(msg)"{{{
122+
" Pymode's debug function.
123+
" Should be called by other pymode's functions to report outputs. See
124+
" the function PymodeDebugFolding for example.
125+
" TODO: why echom here creates a problem?
126+
" echom '' . a:msg + '|||||||||||'
127+
128+
letl:info_separator=repeat('-',79)
129+
123130
ifg:pymode_debug
124-
letg:pymode_debug+=1
125-
echomstring(g:pymode_debug) .':' .string(a:msg)
131+
if !exists('g:pymode_debug_counter')
132+
letg:pymode_debug_counter=0
133+
endif
134+
letg:pymode_debug_counter+=1
135+
" NOTE: Print a separator for every message except folding ones (since
136+
" they could be many).
137+
ifa:msg!~'has folding:'
138+
echoml:info_separator
139+
endif
140+
echom'' .'pymode debug msg' .g:pymode_debug_counter .':' .a:msg
126141
endif
127142
endfunction"}}}
128143

‎autoload/pymode/debug.vim

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
" Set debugging functions.
2+
3+
" DESC: Get debug information about pymode problem.
4+
fun!pymode#debug#sysinfo()"{{{
5+
" OS info. {{{
6+
letl:os_name="Unknown"
7+
ifhas('win16')||has('win32')||has('win64')
8+
letl:os_name="Windows"
9+
else
10+
letl:os_name=substitute(system('uname'),"\n","","")
11+
endif
12+
callpymode#debug("Operating system:" .l:os_name)
13+
" }}}
14+
" Loaded scripts info. {{{
15+
callpymode#debug("Scriptnames:")
16+
letl:scriptnames_var=execute('scriptnames')
17+
" }}}
18+
" Variables info. {{{
19+
" Drop verbose file temporarily to prevent the 'let' from showing up.
20+
letl:tmp= &verbosefile
21+
setverbosefile=
22+
letl:all_variables=filter(
23+
\split(execute('let','silent!'),'\n'),
24+
\'v:val =~ "^pymode"')
25+
let &verbosefile=l:tmp
26+
" NOTE: echom does not display multiline messages. Thus a for loop is
27+
" needed.
28+
callpymode#debug("Pymode variables:")
29+
for pymodevarinsort(l:all_variables)
30+
echom pymodevar
31+
endfor
32+
" }}}
33+
" Github commit info. {{{
34+
" Find in the scriptnames the first occurence of 'python-mode'. Then parse
35+
" the result outputting its path. This is in turn fed into the git command.
36+
callpymode#debug("Git commit:")
37+
letl:pymode_folder=substitute(
38+
\filter(
39+
\split(l:scriptnames_var,'\n'),
40+
\'v:val =~ "/python-mode/"')[0],
41+
\'\(^\s\+[0-9]\+:\s\+\)\([/~].*python-mode\/\)\(.*\)',
42+
\'\2',
43+
\'')
44+
letl:git_head_sha1=system('git -C' .expand(l:pymode_folder).' rev-parse HEAD' )
45+
echomjoin(filter(split(l:git_head_sha1,'\zs'),'v:val =~? "[0-9A-Fa-f]"'),'')
46+
" }}}
47+
callpymode#debug("End of pymode#debug#sysinfo")
48+
endfunction"}}}
49+
50+
" DESC: Define debug folding function.
51+
function!pymode#debug#foldingexpr(lnum)"{{{
52+
letl:get_folding_result=pymode#folding#expr(a:lnum)
53+
" NOTE: the 'has folding:' expression is special in the pymode#debug.
54+
callpymode#debug('line' .a:lnum .' has folding:' .l:get_folding_result)
55+
returnpymode#folding#expr(a:lnum)
56+
endfunction
57+
" }}}

‎autoload/pymode/folding.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ if s:symbol == ''
2020
endif
2121
" ''''''''
2222

23-
2423
fun!pymode#folding#text()" {{{
2524
letfs=v:foldstart
2625
whilegetline(fs)!~s:def_regex&&getline(fs)!~s:docstring_begin_regex
@@ -182,8 +181,6 @@ fun! s:BlockStart(line_number) "{{{
182181
let max_indent=max([indent(prevnonblank(a:line_number))- &shiftwidth,0])
183182
endif
184183

185-
" " Debug:
186-
187184
returnsearchpos('\v^\s{,'.max_indent.'}(def |class )\w','bcnW')[0]
188185

189186
endfunction"}}}

‎autoload/pymode/troubleshooting.vim

Lines changed: 0 additions & 89 deletions
This file was deleted.

‎debug.vim

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎debugvimrc.vim

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
" Use this settings for testing the plugin.
2+
"
3+
" Run vim with command:
4+
"
5+
" $ vim -u ./debug.vim /my/py/file.py
6+
"
7+
" Only python-mode will be loaded.
8+
9+
" Modify vimrc configuration.
10+
execute('set rtp+='.expand('<sfile>:p:h'))
11+
setrtp-=$HOME/.vim
12+
setrtp-=$HOME/.vim/after
13+
setnocompatible
14+
15+
" Activate debugging.
16+
letg:pymode_debug=1
17+
18+
" Define a common shell for non Windows systems.
19+
if ! (has('win16')||has('win32')||has('win64'))
20+
setshell=/bin/bash
21+
endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp