diff --git a/.hgignore b/.hgignore index a8eb175acf..284a6839f2 100644 --- a/.hgignore +++ b/.hgignore @@ -38,6 +38,9 @@ src/Obj*/pathdef.c gvimext.dll gvimext.lib +# Mac OSX +src/xxd/xxd.dSYM + # All platforms *.rej *.orig diff --git a/.hgtags b/.hgtags index 797165d48d..03cc67a27c 100644 --- a/.hgtags +++ b/.hgtags @@ -2570,3 +2570,21 @@ f5c822e5a0eba6f490d0be9f6892de929295be87 v7-3-1230 537bbfff0c5c0bc2307a85133f59f07b00c55e41 v7-3-1231 a594ce86b5eade96cb84415b3b027abe611c2238 v7-3-1232 4ed713442c51625160cd0bca612d9a3417e4ba14 v7-3-1233 +f4969f8f66e974584e8e7815d0a262c5dca79638 v7-3-1234 +9ae0fe46777674504e0f372e68cfb8e0be81b2ee v7-3-1235 +39980afcf54aafdb9255424adf5808af45ab2242 v7-3-1236 +5b2c8f3b390632e1e57a3839f040146f6798a969 v7-3-1237 +048c69ebe8eecb218320030d9ea41fe4f6290848 v7-3-1238 +e130cc3d17af412971143b8420d6e7b1cbd13ff2 v7-3-1239 +bc9125136c69a4feecb4b68912fa04380f42b77f v7-3-1240 +c8747604696795a300f6ff05091813d691f9a488 v7-3-1241 +b4a2eaf28b51327b4e56b4eacf4b5d72a52560f6 v7-3-1242 +8a7d3a73adabaad5e9fe079acf6431982145c7d1 v7-3-1243 +b4a71dbdb78790ca423103ad5deb71b1df9b5b04 v7-3-1244 +43329b2b5b79ed2e1017869ee2e0b1caeaf2f0f6 v7-3-1245 +a1b41dabc682ed8f8770a12c2d3a227eb348885b v7-3-1246 +f451d60ab8ec56d02a7b5f2d5c16187566279886 v7-3-1247 +3717d569027d8ec8b62e42e33f91333ac22ce6ba v7-3-1248 +b614332f7df2f6f471bb4bd93767becd7844b90c v7-3-1249 +6aecf486bb347ac6885afe36d62ddbbf2457f898 v7-3-1250 +788f4802967766b7f3d6dce83cc027baef422f4a v7-3-1251 diff --git a/Filelist b/Filelist index 7fd4f69c3d..669e705413 100644 --- a/Filelist +++ b/Filelist @@ -87,6 +87,10 @@ SRC_ALL = \ src/testdir/python2/*.py \ src/testdir/python3/*.py \ src/testdir/pythonx/*.py \ + src/testdir/pythonx/topmodule/__init__.py \ + src/testdir/pythonx/topmodule/submodule/__init__.py \ + src/testdir/pythonx/topmodule/submodule/subsubmodule/__init__.py \ + src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py \ src/testdir/python_after/*.py \ src/testdir/python_before/*.py \ src/proto.h \ diff --git a/runtime/autoload/tohtml.vim b/runtime/autoload/tohtml.vim index 9be2d29340..5cb23a6146 100644 --- a/runtime/autoload/tohtml.vim +++ b/runtime/autoload/tohtml.vim @@ -1,6 +1,6 @@ " Vim autoload file for the tohtml plugin. " Maintainer: Ben Fritz -" Last Change: 2013 May 31 +" Last Change: 2013 Jun 19 " " Additional contributors: " @@ -401,15 +401,15 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ call add(html, '') let body_line_num = len(html) if !empty(s:settings.prevent_copy) - call add(html, "") + call add(html, "") call add(html, "") call add(html, "
0
") call add(html, "
") call add(html, "
") else - call add(html, '') + call add(html, '') endif - call add(html, "") + call add(html, "
") call add(html, '') for buf in a:win_list @@ -475,7 +475,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ let temp = getline(1,'$') " clean out id on the main content container because we already set it on " the table - let temp[0] = substitute(temp[0], " id='vimCodeElement'", "", "") + let temp[0] = substitute(temp[0], " id='vimCodeElement[^']*'", "", "") " undo deletion of start and end part " so we can later save the file as valid html " TODO: restore using grabbed lines if undolevel is 1? @@ -568,9 +568,9 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ \ ' var emWidth = document.getElementById("oneEmWidth").clientWidth;', \ ' if (inputWidth > goodWidth) {', \ ' while (ratio < 100*goodWidth/emWidth && ratio < 100) {', - \ ' ratio += 5;', - \ ' }', - \ ' document.getElementById("vimCodeElement").className = "em"+ratio;', + \ ' ratio += 5;', + \ ' }', + \ ' document.getElementById("vimCodeElement'.s:settings.id_suffix.'").className = "em"+ratio;', \ ' }', \ '}' \ ]) @@ -596,7 +596,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ \ "", \ " /* navigate upwards in the DOM tree to open all folds containing the line */", \ " var node = lineElem;", - \ " while (node && node.id != 'vimCodeElement')", + \ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')", \ " {", \ " if (node.className == 'closed-fold')", \ " {", @@ -722,6 +722,7 @@ func! tohtml#GetUserSettings() "{{{ call tohtml#GetOption(user_settings, 'no_invalid', 0 ) call tohtml#GetOption(user_settings, 'whole_filler', 0 ) call tohtml#GetOption(user_settings, 'use_xhtml', 0 ) + call tohtml#GetOption(user_settings, 'line_ids', user_settings.number_lines ) " }}} " override those settings that need it {{{ @@ -855,6 +856,20 @@ func! tohtml#GetUserSettings() "{{{ let user_settings.no_invalid = 0 endif + if exists('g:html_id_expr') + let user_settings.id_suffix = eval(g:html_id_expr) + if user_settings.id_suffix !~ '^[-_:.A-Za-z0-9]*$' + echohl WarningMsg + echomsg '2html: g:html_id_expr evaluated to invalid string for HTML id attributes' + echomsg '2html: Omitting user-specified suffix' + echohl None + sleep 3 + let user_settings.id_suffix="" + endif + else + let user_settings.id_suffix="" + endif + " TODO: font return user_settings diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index e2e400f5ad..c8c2bfa4b7 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.3. Last change: 2013 Jun 06 +*index.txt* For Vim version 7.3. Last change: 2013 Jun 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -801,6 +801,10 @@ tag char note action in Normal mode ~ |zE| zE eliminate all folds |zF| zF create a fold for N lines |zG| zG mark word as good spelled word +|zH| zH when 'wrap' off scroll half a screenwidth + to the right +|zL| zL when 'wrap' off scroll half a screenwidth + to the left |zM| zM set 'foldlevel' to zero |zN| zN set 'foldenable' |zO| zO open folds recursively diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 856726a998..402f5a933e 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -1,4 +1,4 @@ -*intro.txt* For Vim version 7.3. Last change: 2012 Sep 05 +*intro.txt* For Vim version 7.3. Last change: 2013 Jun 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -261,6 +261,7 @@ Vim would never have become what it is now, without the help of these people! I wish to thank all the people that sent me bug reports and suggestions. The list is too long to mention them all here. Vim would not be the same without the ideas from all these people: They keep Vim alive! +*love* *peace* *friendship* *gross-national-happiness* In this documentation there are several references to other versions of Vi: diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 7ebaa28b70..57f1dcb36e 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4094,6 +4094,26 @@ A jump table for the options with a short description can be found at |Q_op|. Can be overruled by using "\c" or "\C" in the pattern, see |/ignorecase|. + *'imactivatefunc'* *'imaf'* +'imactivatefunc' 'imaf' string (default "") + global + {not in Vi} + {only available when compiled with |+xim| and + |+GUI_GTK|} + This option specifies a function that will be called to + activate/inactivate Input Method. + + Example: > + function ImActivateFunc(active) + if a:active + ... do something + else + ... do something + endif + " return value is not used + endfunction + set imactivatefunc=ImActivateFunc +< *'imactivatekey'* *'imak'* 'imactivatekey' 'imak' string (default "") global @@ -4191,6 +4211,24 @@ A jump table for the options with a short description can be found at |Q_op|. The value 0 may not work correctly with Athena and Motif with some XIM methods. Use 'imdisable' to disable XIM then. + *'imstatusfunc'* *'imsf'* +'imstatusfunc' 'imsf' string (default "") + global + {not in Vi} + {only available when compiled with |+xim| and + |+GUI_GTK|} + This option specifies a function that is called to obtain the status + of Input Method. It must return a positive number when IME is active. + + Example: > + function ImStatusFunc() + let is_active = ...do something + return is_active ? 1 : 0 + endfunction + set imstatusfunc=ImStatusFunc +< + NOTE: This function is invoked very often. Keep it fast. + *'include'* *'inc'* 'include' 'inc' string (default "^\s*#\s*include") global or local to buffer |global-local| diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 8cdd0a33df..32d7ae1afe 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.3. Last change: 2013 Jun 06 +*syntax.txt* For Vim version 7.3. Last change: 2013 Jun 26 VIM REFERENCE MANUAL by Bram Moolenaar @@ -379,12 +379,12 @@ settings, depending on which syntax is active. Example: > 2HTML *2html.vim* *convert-to-HTML* This is not a syntax file itself, but a script that converts the current -window into HTML. Vim opens a new window in which it builds the HTML file. +window into HTML. Vim opens a new window in which it builds the HTML file. -After you save the resulting file, you can view it with any browser. The -colors should be exactly the same as you see them in Vim. You can jump to -specific lines by adding (for example) #L123 or #123 to the end of the URL in -your browser's address bar (#123 only with javascript support). And with +After you save the resulting file, you can view it with any browser. The +colors should be exactly the same as you see them in Vim. With +|g:html_line_ids| you can jump to specific lines by adding (for example) #L123 +or #123 to the end of the URL in your browser's address bar. And with |g:html_dynamic_folds| enabled, you can show or hide the text that is folded in Vim. @@ -425,15 +425,14 @@ and last line to be converted. Example, using the last set Visual area: > |g:html_end_line| to the start and end of the range, respectively. Default range is the entire buffer. - If the current window is part of a |diff|, unless - |g:html_diff_one_file| is set, :TOhtml will convert - all windows which are part of the diff in the current - tab and place them side-by-side in a
element - in the generated HTML. When this happens you can jump - to lines in specific windows with (for example) #W1L42 - for line 42 in the first diffed window, or #W3L87 for - line 87 in the third. Omitting the window ID will - default to the first window if javascript is enabled. + If the current window is part of a |diff|, unless + |g:html_diff_one_file| is set, :TOhtml will convert + all windows which are part of the diff in the current + tab and place them side-by-side in a
element + in the generated HTML. With |g:html_line_ids| you can + jump to lines in specific windows with (for example) + #W1L42 for line 42 in the first diffed window, or + #W3L87 for line 87 in the third. Examples: > @@ -443,9 +442,9 @@ and last line to be converted. Example, using the last set Visual area: > < *g:html_diff_one_file* Default: 0. -When 0, all windows involved in a |diff| in the current tab page are converted -to HTML and placed side-by-side in a
element. -When 1, only the current buffer is converted. +When 0, and using |:TOhtml| all windows involved in a |diff| in the current tab +page are converted to HTML and placed side-by-side in a
element. When +1, only the current buffer is converted. Example: > let g:html_diff_one_file = 1 @@ -494,6 +493,23 @@ Force to omit the line numbers: > :let g:html_number_lines = 0 Go back to the default to use 'number' by deleting the variable: > :unlet g:html_number_lines +< + *g:html_line_ids* +Default: 1 if |g:html_number_lines| is set, 0 otherwise. +When 1, adds an HTML id attribute to each line number, or to an empty +inserted for that purpose if no line numbers are shown. This ID attribute +takes the form of L123 for single-buffer HTML pages, or W2L123 for diff-view +pages, and is used to jump to a specific line (in a specific window of a diff +view). Javascript is inserted to open any closed dynamic folds +(|g:html_dynamic_folds|) containing the specificed line before jumping. The +javascript also allows omitting the window ID in the url, and the leading L. +For example: > + + page.html#L123 jumps to line 123 in a single-buffer file + page.html#123 does the same + + diff.html#W1L42 jumps to line 42 in the first window in a diff + diff.html#42 does the same < *g:html_use_css* Default: 1. @@ -603,6 +619,25 @@ they will not be openable without a foldcolumn. > :let g:html_hover_unfold = 1 < + *g:html_id_expr* +Default: "" +Dynamic folding and jumping to line IDs rely on unique IDs within the document +to work. If generated HTML is copied into a larger document, these IDs are no +longer guaranteed to be unique. Set g:html_id_expr to an expression Vim can +evaluate to get a unique string to append to each ID used in a given document, +so that the full IDs will be unique even when combined with other content in a +larger HTML document. Example, to append _ and the buffer number to each ID: > + + :let g:html_id_expr = '"_".bufnr("%")' +< +To append a string "_mystring" to the end of each ID: > + + :let g:html_id_expr = '"_mystring"' +< +Note, when converting a diff view to HTML, the expression will only be +evaluated for the first window in the diff, and the result used for all the +windows. + *TOhtml-wrap-text* *g:html_pre_wrap* Default: current 'wrap' setting. When 0, if |g:html_no_pre| is 0 or unset, the text in the generated HTML does @@ -1318,8 +1353,8 @@ FORTRAN *fortran.vim* *ft-fortran-syntax* Default highlighting and dialect ~ Highlighting appropriate for Fortran 2008 is used by default. This choice -should be appropriate for most users most of the time because Fortran 2008 is -almost a superset of previous versions (Fortran 2003, 95, 90, and 77). +should be appropriate for most users most of the time because Fortran 2008 is +almost a superset of previous versions (Fortran 2003, 95, 90, and 77). Fortran source code form ~ Fortran code can be in either fixed or free source form. Note that the @@ -1410,7 +1445,7 @@ items. If you use F, the advantage of setting the dialect appropriately is that other legacy features excluded from F will be highlighted as todo items and -that free source form will be assumed. +that free source form will be assumed. The dialect can be selected in various ways. If all your fortran files use the same dialect, set the global variable fortran_dialect in your .vimrc prior @@ -1444,13 +1479,13 @@ Fortran comment of the form > For previous versions of the syntax, you may have set fortran_dialect to the now-obsolete values "f77", "f90", "f95", or "elf". Such settings will be silently handled as "f08". Users of "elf" may wish to experiment with "F" -instead. +instead. The syntax/fortran.vim script contains embedded comments that tell you how to comment and/or uncomment some lines to (a) activate recognition of some non-standard, vendor-supplied intrinsics and (b) to prevent features deleted or declared obsolescent in the 2008 standard from being highlighted as todo -items. +items. Limitations ~ Parenthesis checking does not catch too few closing parentheses. Hollerith @@ -2197,9 +2232,11 @@ PERL *perl.vim* *ft-perl-syntax* There are a number of possible options to the perl syntax highlighting. -If you use POD files or POD segments, you might: > +Inline POD highlighting is now turned on by default. If you don't wish +to have the added complexity of highlighting POD embedded within Perl +files, you may set the 'perl_include_pod' option to 0: > - :let perl_include_pod = 1 + :let perl_include_pod = 0 The reduce the complexity of parsing (and increase performance) you can switch off two elements in the parsing of variable names and contents. > @@ -2252,13 +2289,20 @@ If you want to fold blocks in if statements, etc. as well set the following: > :let perl_fold_blocks = 1 -To avoid folding packages or subs when perl_fold is let, let the appropriate -variable(s): > +Subroutines are folded by default if 'perl_fold' is set. If you do not want +this, you can set 'perl_nofold_subs': > - :unlet perl_nofold_packages - :unlet perl_nofold_subs + :let perl_nofold_subs = 1 +Anonymous subroutines are not folded by default; you may enable their folding +via 'perl_fold_anonymous_subs': > + :let perl_fold_anonymous_subs = 1 + +Packages are also folded by default if 'perl_fold' is set. To disable this +behavior, set 'perl_nofold_packages': > + + :let perl_nofold_packages = 1 PHP3 and PHP4 *php.vim* *php3.vim* *ft-php-syntax* *ft-php3-syntax* @@ -2481,7 +2525,7 @@ If you want all possible Python highlighting (the same as setting the preceding last option and unsetting all other ones): > :let python_highlight_all = 1 -Note: only existence of these options matter, not their value. You can replace +Note: only existence of these options matter, not their value. You can replace 1 above with anything. @@ -2874,9 +2918,24 @@ tcsh_minlines is 100. The disadvantage of using a larger number is that redrawing can become slow. -TEX *tex.vim* *ft-tex-syntax* +TEX *tex.vim* *ft-tex-syntax* *latex-syntax* - *tex-folding* + Tex Contents~ + Tex: Want Syntax Folding? |tex-folding| + Tex: No Spell Checking Wanted |g:tex_nospell| + Tex: Don't Want Spell Checking In Comments? |tex-nospell| + Tex: Want Spell Checking in Verbatim Zones? |tex-verb| + Tex: Run-on Comments or MathZones |tex-runon| + Tex: Slow Syntax Highlighting? |tex-slow| + Tex: Want To Highlight More Commands? |tex-morecommands| + Tex: Excessive Error Highlighting? |tex-error| + Tex: Need a new Math Group? |tex-math| + Tex: Starting a New Style? |tex-style| + Tex: Taking Advantage of Conceal Mode |tex-conceal| + Tex: Selective Conceal Mode |g:tex_conceal| + Tex: Controlling iskeyword |g:tex_isk| + + *tex-folding* *g:tex_fold_enabled* Tex: Want Syntax Folding? ~ As of version 28 of , syntax-based folding of parts, chapters, @@ -2886,24 +2945,27 @@ in your <.vimrc>, and :set fdm=syntax. I suggest doing the latter via a modeline at the end of your LaTeX file: > % vim: fdm=syntax If your system becomes too slow, then you might wish to look into > - http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text + https://vimhelp.appspot.com/vim_faq.txt.html#faq-29.7 < - *tex-nospell* + *g:tex_nospell* + Tex: No Spell Checking Wanted~ + +If you don't want spell checking anywhere in your LaTeX document, put > + let g:tex_nospell=1 +into your .vimrc. If you merely wish to suppress spell checking inside +comments only, see |g:tex_comment_nospell|. + + *tex-nospell* *g:tex_comment_nospell* Tex: Don't Want Spell Checking In Comments? ~ Some folks like to include things like source code in comments and so would prefer that spell checking be disabled in comments in LaTeX files. To do this, put the following in your <.vimrc>: > let g:tex_comment_nospell= 1 -The comment lines > - % nospell{ - ... - % nospell} -will suppress spell checking between them. These comment lines spelling -control are known to be fragile; for example, don't include any of the section -commands (\part, \chapter, \section, \paragraph, etc) inside nospell blocks -or interleave environments (such as math) across nospell blocks. - *tex-verb* +If you want to suppress spell checking everywhere inside your LaTeX document, +see |g:tex_nospell|. + + *tex-verb* *g:tex_verbspell* Tex: Want Spell Checking in Verbatim Zones?~ Often verbatim regions are used for things like source code; seldom does @@ -2911,7 +2973,7 @@ one want source code spell-checked. However, for those of you who do want your verbatim zones spell-checked, put the following in your <.vimrc>: > let g:tex_verbspell= 1 < - *tex-runon* + *tex-runon* *tex-stopzone* Tex: Run-on Comments or MathZones ~ The highlighting supports TeX, LaTeX, and some AmsTeX. The @@ -2924,7 +2986,7 @@ special "TeX comment" has been provided > which will forcibly terminate the highlighting of either a texZone or a texMathZone. - *tex-slow* + *tex-slow* *tex-sync* Tex: Slow Syntax Highlighting? ~ If you have a slow computer, you may wish to reduce the values for > @@ -2966,7 +3028,39 @@ selectively to enable just some syntax highlighting: > As an example, let g:tex_fast= "M" will allow math-associated highlighting but suppress all the other region-based syntax highlighting. - *tex-morecommands* *tex-package* +Another cause of slow highlighting is due to syntax-driven folding; see +|tex-folding| for a way around this. + + *g:tex_fast* + +Finally, if syntax highlighting is still too slow, you may set > + + :let g:tex_fast= "" + +in your .vimrc. Used this way, the g:tex_fast variable causes the syntax +highlighting script to avoid defining any regions and associated +synchronization. The result will be much faster syntax highlighting; the +price: you will no longer have as much highlighting or any syntax-based +folding, and you will be missing syntax-based error checking. + +You may decide that some syntax is acceptable; you may use the following table +selectively to enable just some syntax highlighting: > + + b : allow bold and italic syntax + c : allow texComment syntax + m : allow texMatcher syntax (ie. {...} and [...]) + M : allow texMath syntax + p : allow parts, chapter, section, etc syntax + r : allow texRefZone syntax (nocite, bibliography, label, pageref, eqref) + s : allow superscript/subscript regions + S : allow texStyle syntax + v : allow verbatim syntax + V : allow texNewEnv and texNewCmd syntax +< +As an example, let g:tex_fast= "M" will allow math-associated highlighting +but suppress all the other region-based syntax highlighting. + + *tex-morecommands* *tex-package* Tex: Want To Highlight More Commands? ~ LaTeX is a programmable language, and so there are thousands of packages full @@ -2978,14 +3072,14 @@ by syntax/tex.vim. Please consider uploading any extensions that you write, which typically would go in $HOME/after/syntax/tex/[pkgname].vim, to http://vim.sf.net/. - *tex-error* + *tex-error* *g:tex_no_error* Tex: Excessive Error Highlighting? ~ The supports lexical error checking of various sorts. Thus, although the error checking is ofttimes very useful, it can indicate errors where none actually are. If this proves to be a problem for you, you may put in your <.vimrc> the following statement: > - let tex_no_error=1 + let g:tex_no_error=1 and all error checking by will be suppressed. *tex-math* @@ -3003,7 +3097,7 @@ and then to the call to it in .vim/after/syntax/tex.vim. The "starform" variable, if true, implies that your new math group has a starred form (ie. eqnarray*). - *tex-style* + *tex-style* *b:tex_stylish* Tex: Starting a New Style? ~ One may use "\makeatletter" in *.tex files, thereby making the use of "@" in @@ -3030,12 +3124,12 @@ In fact, only a few characters are supported as subscripts. One way to use this is to have vertically split windows (see |CTRL-W_v|); one with |'conceallevel'| at 0 and the other at 2; and both using |'scrollbind'|. - *g:tex_conceal* + *g:tex_conceal* Tex: Selective Conceal Mode~ You may selectively use conceal mode by setting g:tex_conceal in your -<.vimrc>. By default it is set to "admgs" to enable conceal for the -following sets of characters: > +<.vimrc>. By default, g:tex_conceal is set to "admgs" to enable concealment +for the following sets of characters: > a = accents/ligatures b = bold and italic @@ -3058,7 +3152,7 @@ with one that works for LaTeX. However, one may override this iskeyword re-setting by setting the variable, g:tex_isk, in one's .vimrc to whatever one wishes and it will be used instead. - + TF *tf.vim* *ft-tf-syntax* @@ -3069,6 +3163,26 @@ set "tf_minlines" to the value you desire. Example: > :let tf_minlines = your choice + *g:tex_isk* *g:tex_stylish* + Tex: Controlling iskeyword~ + +Normally, LaTeX keywords support 0-9, a-z, A-z, and 192-255 only. Latex +keywords don't support the underscore - except when in *.sty files. The +syntax highlighting script handles this with the following logic: + + * If g:tex_stylish exists and is 1 + then the file will be treated as a "sty" file, so the "_" + will be allowed as part of keywords + (irregardless of g:tex_isk) + * Else if the file's suffix is sty, cls, clo, dtx, or ltx, + then the file will be treated as a "sty" file, so the "_" + will be allowed as part of keywords + (irregardless of g:tex_isk) + + * If g:tex_isk exists, then it will be used for the local 'iskeyword' + * Else the local 'iskeyword' will be set to 48-57,a-z,A-Z,192-255 + + VIM *vim.vim* *ft-vim-syntax* *g:vimsyn_minlines* *g:vimsyn_maxlines* @@ -4936,7 +5050,7 @@ restoring "b:current_syntax", since the syntax files do set "w:current_syntax". Once a window has its own syntax, syntax commands executed from other windows -on the same buffer (including :syntax clear) have no effect. Conversely, +on the same buffer (including :syntax clear) have no effect. Conversely, syntax commands executed from that window do not affect other windows on the same buffer. @@ -5141,9 +5255,9 @@ When using the "\@<=" and "\@ -" Last Change: 2013 Jun 12 +" Last Change: 2013 Jun 24 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -930,6 +930,23 @@ au BufNewFile,BufRead *.inf,*.INF setf inform " Initng au BufNewFile,BufRead */etc/initng/**/*.i,*.ii setf initng +" Innovation Data Processing +au BufRead,BufNewFile UPSTREAM.DAT,upstream.dat setf upstreamdat +au BufRead,BufNewFile UPSTREAM.*.DAT,upstream.*.dat setf upstreamdat +au BufRead,BufNewFile *.UPSTREAM.DAT,*.upstream.dat setf upstreamdat +au BufRead,BufNewFile UPSTREAM.LOG,upstream.log setf upstreamlog +au BufRead,BufNewFile UPSTREAM.*.LOG,upstream.*.log setf upstreamlog +au BufRead,BufNewFile *.UPSTREAM.LOG,*.upstream.log setf upstreamlog +au BufRead,BufNewFile UPSTREAMInstall.log,upstreaminstall.log setf upstreaminstalllog +au BufRead,BufNewFile UPSTREAMInstall.*.log,upstreaminstall.*.log setf upstreaminstalllog +au BufRead,BufNewFile *.UPSTREAMInstall.log,*.upstreaminstall.log setf upstreaminstalllog +au BufRead,BufNewFile USSERVER.LOG,usserver.log setf usserverlog +au BufRead,BufNewFile USSERVER.*.LOG,usserver.*.log setf usserverlog +au BufRead,BufNewFile *.USSERVER.LOG,*.usserver.log setf usserverlog +au BufRead,BufNewFile USW2KAgt.log,usw2kagt.log setf usw2kagtlog +au BufRead,BufNewFile USW2KAgt.*.log,usw2kagt.*.log setf usw2kagtlog +au BufRead,BufNewFile *.USW2KAgt.log,*.usw2kagt.log setf usw2kagtlog + " Ipfilter au BufNewFile,BufRead ipf.conf,ipf6.conf,ipf.rules setf ipfilter diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim index 54ed123429..b62a567263 100644 --- a/runtime/indent/python.vim +++ b/runtime/indent/python.vim @@ -2,7 +2,7 @@ " Language: Python " Maintainer: Bram Moolenaar " Original Author: David Bustos -" Last Change: 2012 May 01 +" Last Change: 2013 Jun 21 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -36,7 +36,7 @@ function GetPythonIndent(lnum) if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$' return indent(a:lnum - 1) endif - return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (&sw * 2)) + return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (shiftwidth() * 2)) endif " If the start of the line is in a string don't change the indent. @@ -89,9 +89,9 @@ function GetPythonIndent(lnum) \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" \ . " =~ '\\(Comment\\|String\\)$'") if pp > 0 - return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : &sw) + return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) endif - return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (&sw * 2)) + return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2)) endif if plnumstart == p return indent(plnum) @@ -134,15 +134,15 @@ function GetPythonIndent(lnum) " If the previous line ended with a colon, indent this line if pline =~ ':\s*$' - return plindent + &sw + return plindent + shiftwidth() endif " If the previous line was a stop-execution statement... if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>' " See if the user has already dedented - if indent(a:lnum) > indent(plnum) - &sw + if indent(a:lnum) > indent(plnum) - shiftwidth() " If not, recommend one dedent - return indent(plnum) - &sw + return indent(plnum) - shiftwidth() endif " Otherwise, trust the user return -1 @@ -173,11 +173,11 @@ function GetPythonIndent(lnum) endif " Or the user has already dedented - if indent(a:lnum) <= plindent - &sw + if indent(a:lnum) <= plindent - shiftwidth() return -1 endif - return plindent - &sw + return plindent - shiftwidth() endif " When after a () construct we probably want to go back to the start line. diff --git a/runtime/plugin/tohtml.vim b/runtime/plugin/tohtml.vim index a18e2d167c..a56b95b8a6 100644 --- a/runtime/plugin/tohtml.vim +++ b/runtime/plugin/tohtml.vim @@ -1,6 +1,6 @@ " Vim plugin for converting a syntax highlighted file to HTML. " Maintainer: Ben Fritz -" Last Change: 2013 May 31 +" Last Change: 2013 Jun 12 " " The core of the code is in $VIMRUNTIME/autoload/tohtml.vim and " $VIMRUNTIME/syntax/2html.vim @@ -67,12 +67,18 @@ if exists('g:loaded_2html_plugin') finish endif -let g:loaded_2html_plugin = 'vim7.3_v13' +let g:loaded_2html_plugin = 'vim7.3_v14' " " Changelog: {{{ " -" 7.3_v13 (this version): Keep foldmethod at manual in the generated file and +" 7.3_v14 (this version): Allow suppressing empty created for line +" number anchors when line numbers are not included, +" using g:html_empty_anchors=0. Allow customizing +" important IDs (like line IDs and fold IDs) using +" g:html_id_expr evalutated when the buffer conversion +" is started. +" 7.3_v13 (2eb30f341e8d): Keep foldmethod at manual in the generated file and " insert modeline to set it to manual. " Fix bug: diff mode with 2 unsaved buffers creates a " duplicate of one buffer instead of including both. diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index d964d0e912..468f6aa067 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -2,7 +2,7 @@ " This file is normally sourced from menu.vim. " " Maintainer: Bram Moolenaar -" Last Change: 2010 Jul 26 +" Last Change: 2013 Jun 24 " Define the SetSyn function, used for the Syntax menu entries. " Set 'filetype' and also 'syntax' if it is manually selected. @@ -243,6 +243,11 @@ an 50.50.360 &Syntax.HIJK.Informix\ 4GL :cal SetSyn("fgl") an 50.50.370 &Syntax.HIJK.Initng :cal SetSyn("initng") an 50.50.380 &Syntax.HIJK.Inittab :cal SetSyn("inittab") an 50.50.390 &Syntax.HIJK.Inno\ setup :cal SetSyn("iss") +an 50.50.393 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ dat :cal SetSyn ("upstreamdat") +an 50.50.394 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ log :cal SetSyn ("upstreamlog") +an 50.50.395 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ Install\ log :cal SetSyn ("upstreaminstalllog") +an 50.50.396 &Syntax.HIJK.Innovation\ Data\ Processing.Usserver\ log :cal SetSyn ("usserverlog") +an 50.50.397 &Syntax.HIJK.Innovation\ Data\ Processing.USW2KAgt\ log :cal SetSyn ("usw2kagtlog") an 50.50.400 &Syntax.HIJK.InstallShield\ script :cal SetSyn("ishd") an 50.50.410 &Syntax.HIJK.Interactive\ Data\ Lang :cal SetSyn("idlang") an 50.50.420 &Syntax.HIJK.IPfilter :cal SetSyn("ipfilter") diff --git a/runtime/syntax/2html.vim b/runtime/syntax/2html.vim index 461b47fab4..8001751c5b 100644 --- a/runtime/syntax/2html.vim +++ b/runtime/syntax/2html.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Ben Fritz -" Last Change: 2013 May 31 +" Last Change: 2013 Jun 19 " " Additional contributors: " @@ -450,30 +450,42 @@ endfun " element is supposed to be unselectable or not if s:settings.prevent_copy =~# 'n' if s:settings.number_lines - function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) - if a:lnr > 0 - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'.(exists('g:html_diff_win_num') ? 'W'.g:html_diff_win_num : "").'L'.a:lnr.'" ', 1) - else + if s:settings.line_ids + function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) + if a:lnr > 0 + return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'.(exists('g:html_diff_win_num') ? 'W'.g:html_diff_win_num : "").'L'.a:lnr.s:settings.id_suffix.'" ', 1) + else + return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1) + endif + endfun + else + function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1) - endif - endfun - else + endfun + endif + elseif s:settings.line_ids " if lines are not being numbered the only reason this function gets called " is to put the line IDs on each line; "text" will be emtpy but lnr will " always be non-zero, however we don't want to use the because that " won't work as nice for empty text function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'.(exists('g:html_diff_win_num') ? 'W'.g:html_diff_win_num : "").'L'.a:lnr.'" ', 0) + return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'.(exists('g:html_diff_win_num') ? 'W'.g:html_diff_win_num : "").'L'.a:lnr.s:settings.id_suffix.'" ', 0) endfun endif else - function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) - if a:lnr > 0 - return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'.(exists('g:html_diff_win_num') ? 'W'.g:html_diff_win_num : "").'L'.a:lnr.'" ', 0) - else + if s:settings.line_ids + function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) + if a:lnr > 0 + return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'.(exists('g:html_diff_win_num') ? 'W'.g:html_diff_win_num : "").'L'.a:lnr.s:settings.id_suffix.'" ', 0) + else + return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0) + endif + endfun + else + function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr) return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0) - endif - endfun + endfun + endif endif if s:settings.prevent_copy =~# 'd' function! s:HtmlFormat_d(text, style_id, diff_style_id) @@ -818,50 +830,52 @@ if s:settings.dynamic_folds \ ]) endif -" insert javascript to get IDs from line numbers, and to open a fold before -" jumping to any lines contained therein -call extend(s:lines, [ - \ "", - \ "/* function to open any folds containing a jumped-to line before jumping to it */", - \ "function JumpToLine()", - \ "{", - \ " var lineNum;", - \ " lineNum = window.location.hash;", - \ " lineNum = lineNum.substr(1); /* strip off '#' */", - \ "", - \ " if (lineNum.indexOf('L') == -1) {", - \ " lineNum = 'L'+lineNum;", - \ " }", - \ " lineElem = document.getElementById(lineNum);" - \ ]) -if s:settings.dynamic_folds +if s:settings.line_ids + " insert javascript to get IDs from line numbers, and to open a fold before + " jumping to any lines contained therein call extend(s:lines, [ \ "", - \ " /* navigate upwards in the DOM tree to open all folds containing the line */", - \ " var node = lineElem;", - \ " while (node && node.id != 'vimCodeElement')", - \ " {", - \ " if (node.className == 'closed-fold')", - \ " {", - \ " node.className = 'open-fold';", - \ " }", - \ " node = node.parentNode;", + \ "/* function to open any folds containing a jumped-to line before jumping to it */", + \ "function JumpToLine()", + \ "{", + \ " var lineNum;", + \ " lineNum = window.location.hash;", + \ " lineNum = lineNum.substr(1); /* strip off '#' */", + \ "", + \ " if (lineNum.indexOf('L') == -1) {", + \ " lineNum = 'L'+lineNum;", \ " }", + \ " lineElem = document.getElementById(lineNum);" + \ ]) + if s:settings.dynamic_folds + call extend(s:lines, [ + \ "", + \ " /* navigate upwards in the DOM tree to open all folds containing the line */", + \ " var node = lineElem;", + \ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')", + \ " {", + \ " if (node.className == 'closed-fold')", + \ " {", + \ " node.className = 'open-fold';", + \ " }", + \ " node = node.parentNode;", + \ " }", + \ ]) + endif + call extend(s:lines, [ + \ " /* Always jump to new location even if the line was hidden inside a fold, or", + \ " * we corrected the raw number to a line ID.", + \ " */", + \ " if (lineElem) {", + \ " lineElem.scrollIntoView(true);", + \ " }", + \ " return true;", + \ "}", + \ "if ('onhashchange' in window) {", + \ " window.onhashchange = JumpToLine;", + \ "}" \ ]) endif -call extend(s:lines, [ - \ " /* Always jump to new location even if the line was hidden inside a fold, or", - \ " * we corrected the raw number to a line ID.", - \ " */", - \ " if (lineElem) {", - \ " lineElem.scrollIntoView(true);", - \ " }", - \ " return true;", - \ "}", - \ "if ('onhashchange' in window) {", - \ " window.onhashchange = JumpToLine;", - \ "}" - \ ]) " Small text columns like the foldcolumn and line number column need a weird " hack to work around Webkit's and (in versions prior to 9) IE's lack of support @@ -914,9 +928,9 @@ if !empty(s:settings.prevent_copy) \ ' var emWidth = document.getElementById("oneEmWidth").clientWidth;', \ ' if (inputWidth > goodWidth) {', \ ' while (ratio < 100*goodWidth/emWidth && ratio < 100) {', - \ ' ratio += 5;', - \ ' }', - \ ' document.getElementById("vimCodeElement").className = "em"+ratio;', + \ ' ratio += 5;', + \ ' }', + \ ' document.getElementById("vimCodeElement'.s:settings.id_suffix.'").className = "em"+ratio;', \ ' }', \ '}' \ ]) @@ -932,22 +946,22 @@ call extend(s:lines, [ call extend(s:lines, [""]) if !empty(s:settings.prevent_copy) call extend(s:lines, - \ ["", + \ ["", \ "", \ "
0
", \ "
", \ "
" \ ]) else - call extend(s:lines, [""]) + call extend(s:lines, [""]) endif if s:settings.no_pre " if we're not using CSS we use a font tag which can't have a div inside if s:settings.use_css - call extend(s:lines, ["
"]) + call extend(s:lines, ["
"]) endif else - call extend(s:lines, ["
"])
+  call extend(s:lines, ["
"])
 endif
 
 exe s:orgwin . "wincmd w"
@@ -1364,7 +1378,7 @@ while s:lnum <= s:end
 	let s:foldId = s:foldId + 1
 	let s:new .= ""
+	let s:new .= "fold".s:foldId.s:settings.id_suffix."' class='".s:allfolds[0].type."'>"
 
 
 	" Unless disabled, add a fold column for the opening line of a fold.
@@ -1376,19 +1390,19 @@ while s:lnum <= s:end
 	  " add fold column that can open the new fold
 	  if s:allfolds[0].level > 1 && s:firstfold
 	    let s:new = s:new . s:FoldColumn_build('|', s:allfolds[0].level - 1, 0, "",
-		  \ 'toggle-open FoldColumn','javascript:toggleFold("fold'.s:foldstack[0].id.'");')
+		  \ 'toggle-open FoldColumn','javascript:toggleFold("fold'.s:foldstack[0].id.s:settings.id_suffix.'");')
 	  endif
 	  " add the filler spaces separately from the '+' char so that it can be
 	  " shown/hidden separately during a hover unfold
 	  let s:new = s:new . s:FoldColumn_build("+", 1, 0, "",
-		\ 'toggle-open FoldColumn', 'javascript:toggleFold("fold'.s:foldId.'");')
+		\ 'toggle-open FoldColumn', 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
 	  " If this is not the last fold we're opening on this line, we need
 	  " to keep the filler spaces hidden if the fold is opened by mouse
 	  " hover. If it is the last fold to open in the line, we shouldn't hide
 	  " them, so don't apply the toggle-filler class.
 	  let s:new = s:new . s:FoldColumn_build(" ", 1, s:foldcolumn - s:allfolds[0].level - 1, "",
 		\ 'toggle-open FoldColumn'. (get(s:allfolds, 1, {'firstline': 0}).firstline == s:lnum ?" toggle-filler" :""),
-		\ 'javascript:toggleFold("fold'.s:foldId.'");')
+		\ 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
 
 	  " add fold column that can close the new fold
 	  " only add extra blank space if we aren't opening another fold on the
@@ -1402,11 +1416,11 @@ while s:lnum <= s:end
 	    " the first fold in a line has '|' characters from folds opened in
 	    " previous lines, before the '-' for this fold
 	    let s:new .= s:FoldColumn_build('|', s:allfolds[0].level - 1, s:extra_space, '-',
-		  \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'.s:foldId.'");')
+		  \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
 	  else
 	    " any subsequent folds in the line only add a single '-'
 	    let s:new = s:new . s:FoldColumn_build("-", 1, s:extra_space, "",
-		  \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'.s:foldId.'");')
+		  \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
 	  endif
 	  let s:firstfold = 0
 	endif
@@ -1440,7 +1454,7 @@ while s:lnum <= s:end
 	  " add the fold column for folds not on the opening line
 	  if get(s:foldstack, 0).firstline < s:lnum
 	    let s:new = s:new . s:FoldColumn_build('|', s:foldstack[0].level, s:foldcolumn - s:foldstack[0].level, "",
-		  \ 'FoldColumn', 'javascript:toggleFold("fold'.s:foldstack[0].id.'");')
+		  \ 'FoldColumn', 'javascript:toggleFold("fold'.s:foldstack[0].id.s:settings.id_suffix.'");')
 	  endif
 	endif
       endif
@@ -1449,7 +1463,7 @@ while s:lnum <= s:end
     " Now continue with the unfolded line text
     if s:settings.number_lines
       let s:new = s:new . s:HtmlFormat_n(s:numcol, s:LINENR_ID, 0, s:lnum)
-    else
+    elseif s:settings.line_ids
       let s:new = s:new . s:HtmlFormat_n("", s:LINENR_ID, 0, s:lnum)
     endif
 
diff --git a/runtime/syntax/clean.vim b/runtime/syntax/clean.vim
index 7bdacfc507..11aa028b71 100644
--- a/runtime/syntax/clean.vim
+++ b/runtime/syntax/clean.vim
@@ -2,8 +2,7 @@
 " Language:		Clean
 " Author:		Pieter van Engelen 
 " Co-Author:	Arthur van Leeuwen 
-" Previous Change:	2011 Dec 25 by Thilo Six
-" Last Change:	2013 Apr 25 by Jurriën Stutterheim
+" Last Change:	2013 Jun 19 by Jurriën Stutterheim
 
 " For version 5.x: Clear all syntax items
 " For version 6.x: Quit when a syntax file was already loaded
@@ -19,7 +18,6 @@ set cpo&vim
 " Some Clean-keywords
 syn keyword cleanConditional if case
 syn keyword cleanLabel let! with where in of
-syn keyword cleanInclude from import qualified
 syn keyword cleanSpecial Start
 syn keyword cleanKeyword infixl infixr infix
 syn keyword cleanBasicType Int Real Char Bool String
@@ -27,6 +25,10 @@ syn keyword cleanSpecialType World ProcId Void Files File
 syn keyword cleanModuleSystem module implementation definition system
 syn keyword cleanTypeClass class instance export
 
+" Import highlighting
+syn region cleanIncludeRegion start="^\s*\(from\|import\|\s\+\(as\|qualified\)\)" end="\n" contains=cleanIncludeKeyword keepend
+syn keyword cleanIncludeKeyword contained from import as qualified
+
 " To do some Denotation Highlighting
 syn keyword cleanBoolDenot True False
 syn region  cleanStringDenot start=+"+ end=+"+
@@ -75,7 +77,7 @@ if version >= 508 || !exists("did_clean_syntax_init")
    HiLink cleanLabel		Label
    HiLink cleanKeyword      Keyword
    " Generic Preprocessing
-   HiLink cleanInclude      Include
+   HiLink cleanIncludeKeyword      Include
    HiLink cleanModuleSystem PreProc
    " Type
    HiLink cleanBasicType    Type
diff --git a/runtime/syntax/esmtprc.vim b/runtime/syntax/esmtprc.vim
index b36739ac20..b22b1a1416 100644
--- a/runtime/syntax/esmtprc.vim
+++ b/runtime/syntax/esmtprc.vim
@@ -12,23 +12,23 @@ elseif exists("b:current_syntax")
 endif
 
 "All options
-:syntax keyword	esmtprcOptions hostname username password starttls certificate_passphrase preconnect identity mda
+syntax keyword	esmtprcOptions hostname username password starttls certificate_passphrase preconnect identity mda
 
 "All keywords
-:syntax keyword esmtprcIdentifier default enabled disabled required
+syntax keyword esmtprcIdentifier default enabled disabled required
 
 "We're trying to be smarer than /."*@.*/ :)
-:syntax match esmtprcAddress /[a-z0-9_.-]*[a-z0-9]\+@[a-z0-9_.-]*[a-z0-9]\+\.[a-z]\+/
-:syntax match esmtprcFulladd /[a-z0-9_.-]*[a-z0-9]\+\.[a-z]\+:[0-9]\+/
+syntax match esmtprcAddress /[a-z0-9_.-]*[a-z0-9]\+@[a-z0-9_.-]*[a-z0-9]\+\.[a-z]\+/
+syntax match esmtprcFulladd /[a-z0-9_.-]*[a-z0-9]\+\.[a-z]\+:[0-9]\+/
  
 "String..
-:syntax region esmtprcString start=/"/ end=/"/
+syntax region esmtprcString start=/"/ end=/"/
 
 
-:highlight link esmtprcOptions		Label
-:highlight link esmtprcString 		String
-:highlight link esmtprcAddress		Type
-:highlight link esmtprcIdentifier 	Identifier
-:highlight link esmtprcFulladd		Include
+highlight link esmtprcOptions		Label
+highlight link esmtprcString 		String
+highlight link esmtprcAddress		Type
+highlight link esmtprcIdentifier 	Identifier
+highlight link esmtprcFulladd		Include
 
-let b:current_syntax="esmtprc"
+let b:current_syntax = "esmtprc"
diff --git a/runtime/syntax/upstreamdat.vim b/runtime/syntax/upstreamdat.vim
new file mode 100644
index 0000000000..7be806730d
--- /dev/null
+++ b/runtime/syntax/upstreamdat.vim
@@ -0,0 +1,296 @@
+" Vim syntax file
+" Language:		Innovation Data Processing upstream.dat file
+" Maintainer:		Rob Owens 
+" Latest Revision:	2013-06-17
+
+" Quit when a syntax file was already loaded
+if exists("b:current_syntax")
+  finish
+endif
+
+syn keyword upstreamdat_Parameter ACCEPTPCREMOTE 
+syn keyword upstreamdat_Parameter ACCEPTREMOTE 
+syn keyword upstreamdat_Parameter ACTION 
+syn keyword upstreamdat_Parameter ACTIVATEONENTRY 
+syn keyword upstreamdat_Parameter ARCHIVEBIT 
+syn keyword upstreamdat_Parameter ARCHIVEBIT 
+syn keyword upstreamdat_Parameter ASCTOEBC 
+syn keyword upstreamdat_Parameter ASRBACKUP 
+syn keyword upstreamdat_Parameter ATTENDED 
+syn keyword upstreamdat_Parameter AUTHORITATIVE 
+syn keyword upstreamdat_Parameter AUTHORITATIVERESTORE 
+syn keyword upstreamdat_Parameter AUTHORITATIVERESTORE 
+syn keyword upstreamdat_Parameter BACKUPPROFILE 
+syn keyword upstreamdat_Parameter BACKUPPROFILE2 
+syn keyword upstreamdat_Parameter BACKUPREPARSEFILES 
+syn keyword upstreamdat_Parameter BACKUPREPARSEFILES 
+syn keyword upstreamdat_Parameter BACKUPVERIFY 
+syn keyword upstreamdat_Parameter BLANKTRUNC 
+syn keyword upstreamdat_Parameter CALCDASDSIZE 
+syn keyword upstreamdat_Parameter CHANGEDIRATTRIBS 
+syn keyword upstreamdat_Parameter CHANGEDIRATTRIBS 
+syn keyword upstreamdat_Parameter COMPRESSLEVEL 
+syn keyword upstreamdat_Parameter CONTROLFILE 
+syn keyword upstreamdat_Parameter DASDOVERRIDE 
+syn keyword upstreamdat_Parameter DATELIMIT 
+syn keyword upstreamdat_Parameter DATELIMIT 
+syn keyword upstreamdat_Parameter DAYSOLD 
+syn keyword upstreamdat_Parameter DAYSOLD 
+syn keyword upstreamdat_Parameter DELETED 
+syn keyword upstreamdat_Parameter DELETED 
+syn keyword upstreamdat_Parameter DELETEPROMPTS 
+syn keyword upstreamdat_Parameter DELETEPROMPTS 
+syn keyword upstreamdat_Parameter DESTINATION 
+syn keyword upstreamdat_Parameter DESTINATION 
+syn keyword upstreamdat_Parameter DIRDELETE 
+syn keyword upstreamdat_Parameter DIRECTORVMC 
+syn keyword upstreamdat_Parameter DIRONLYRESTOREOK 
+syn keyword upstreamdat_Parameter DIRSONLY 
+syn keyword upstreamdat_Parameter DIRSONLY 
+syn keyword upstreamdat_Parameter DISASTERRECOVERY 
+syn keyword upstreamdat_Parameter DISPLAY 
+syn keyword upstreamdat_Parameter DRIVEALIAS 
+syn keyword upstreamdat_Parameter DRIVEALIAS 
+syn keyword upstreamdat_Parameter DUALCOPY 
+syn keyword upstreamdat_Parameter DUPDAYS 
+syn keyword upstreamdat_Parameter DUPLICATE 
+syn keyword upstreamdat_Parameter EBCTOASC 
+syn keyword upstreamdat_Parameter ENCRYPT 
+syn keyword upstreamdat_Parameter ENCRYPTLEVEL 
+syn keyword upstreamdat_Parameter EXCLUDELISTNAME 
+syn keyword upstreamdat_Parameter FAILBACKUPONERROR 
+syn keyword upstreamdat_Parameter FAILBACKUPONERROR 
+syn keyword upstreamdat_Parameter FAILIFNOFILES 
+syn keyword upstreamdat_Parameter FAILIFNOFILES 
+syn keyword upstreamdat_Parameter FAILIFSKIP 
+syn keyword upstreamdat_Parameter FAILJOB 
+syn keyword upstreamdat_Parameter FAILRESTOREONERROR 
+syn keyword upstreamdat_Parameter FAILRESTOREONERROR 
+syn keyword upstreamdat_Parameter FILEDATE 
+syn keyword upstreamdat_Parameter FILEDATE 
+syn keyword upstreamdat_Parameter FILEDELETE 
+syn keyword upstreamdat_Parameter FILEDELETE 
+syn keyword upstreamdat_Parameter FILES 
+syn keyword upstreamdat_Parameter FILES 
+syn keyword upstreamdat_Parameter FILESOPENFORUPDAT 
+syn keyword upstreamdat_Parameter FILESOPENFORUPDAT 
+syn keyword upstreamdat_Parameter FILETRANSFER 
+syn keyword upstreamdat_Parameter GETREMOTEFILES 
+syn keyword upstreamdat_Parameter HARDLINKDB 
+syn keyword upstreamdat_Parameter HARDLINKS 
+syn keyword upstreamdat_Parameter HARDLINKS 
+syn keyword upstreamdat_Parameter HIDDENFILES 
+syn keyword upstreamdat_Parameter HIDDENFILES 
+syn keyword upstreamdat_Parameter HOLDTAPE 
+syn keyword upstreamdat_Parameter HOLDUSERDIRS 
+syn keyword upstreamdat_Parameter HOSTFILENAME 
+syn keyword upstreamdat_Parameter HOSTRECORD 
+syn keyword upstreamdat_Parameter HOSTSORT 
+syn keyword upstreamdat_Parameter IGNOREPLUGINSFORRESTORE 
+syn keyword upstreamdat_Parameter INCRDB 
+syn keyword upstreamdat_Parameter INCRDBARCHIVEBIT 
+syn keyword upstreamdat_Parameter INCRDBDELETEDFILES 
+syn keyword upstreamdat_Parameter INCREMENTAL 
+syn keyword upstreamdat_Parameter INCREMENTAL 
+syn keyword upstreamdat_Parameter INQOPTIONS 
+syn keyword upstreamdat_Parameter INSTALLWIN2KAGENT 
+syn keyword upstreamdat_Parameter INSTALLWIN2KAGENT 
+syn keyword upstreamdat_Parameter JOBOPTIONS 
+syn keyword upstreamdat_Parameter JOBRETURNCODEMAP 
+syn keyword upstreamdat_Parameter JOBWAITTIMELIMIT 
+syn keyword upstreamdat_Parameter KEEPALIVE 
+syn keyword upstreamdat_Parameter LANINTERFACE 
+syn keyword upstreamdat_Parameter LANWSNAME 
+syn keyword upstreamdat_Parameter LANWSPASSWORD 
+syn keyword upstreamdat_Parameter LASTACCESS 
+syn keyword upstreamdat_Parameter LASTACCESS 
+syn keyword upstreamdat_Parameter LATESTDATE 
+syn keyword upstreamdat_Parameter LATESTDATE 
+syn keyword upstreamdat_Parameter LATESTTIME 
+syn keyword upstreamdat_Parameter LATESTTIME 
+syn keyword upstreamdat_Parameter LATESTVERSION 
+syn keyword upstreamdat_Parameter LINEBLOCK 
+syn keyword upstreamdat_Parameter LINETRUNC 
+syn keyword upstreamdat_Parameter LISTENFORREMOTE 
+syn keyword upstreamdat_Parameter LOCALBACKUP 
+syn keyword upstreamdat_Parameter LOCALBACKUPDIR 
+syn keyword upstreamdat_Parameter LOCALBACKUPMAX 
+syn keyword upstreamdat_Parameter LOCALBACKUPMAXFILESIZE 
+syn keyword upstreamdat_Parameter LOCALBACKUPMAXSIZE 
+syn keyword upstreamdat_Parameter LOCALEXCLUDEFILE 
+syn keyword upstreamdat_Parameter LOCALPARAMETERS 
+syn keyword upstreamdat_Parameter LOCALPASSWORD 
+syn keyword upstreamdat_Parameter LOCALRESTORE 
+syn keyword upstreamdat_Parameter LOCALUSER 
+syn keyword upstreamdat_Parameter LOFS 
+syn keyword upstreamdat_Parameter LOGNONFATAL 
+syn keyword upstreamdat_Parameter MAXBACKUPFILESFAIL 
+syn keyword upstreamdat_Parameter MAXBACKUPTIME 
+syn keyword upstreamdat_Parameter MAXDUPS 
+syn keyword upstreamdat_Parameter MAXFILENAMESIZE 
+syn keyword upstreamdat_Parameter MAXKFILESIZE 
+syn keyword upstreamdat_Parameter MAXLOGDAYS 
+syn keyword upstreamdat_Parameter MAXRESTOREFILESFAIL 
+syn keyword upstreamdat_Parameter MAXRESTORETIME 
+syn keyword upstreamdat_Parameter MAXRETRY 
+syn keyword upstreamdat_Parameter MAXRPTDAYS 
+syn keyword upstreamdat_Parameter MERGE 
+syn keyword upstreamdat_Parameter MIGRBITS 
+syn keyword upstreamdat_Parameter MIGRBITS 
+syn keyword upstreamdat_Parameter MINCOMPRESSSIZE 
+syn keyword upstreamdat_Parameter MINIMIZE 
+syn keyword upstreamdat_Parameter MODIFYFILE 
+syn keyword upstreamdat_Parameter MOUNTPOINTS 
+syn keyword upstreamdat_Parameter MOUNTPOINTS 
+syn keyword upstreamdat_Parameter NDS 
+syn keyword upstreamdat_Parameter NDS 
+syn keyword upstreamdat_Parameter NEWFILECOMPARE 
+syn keyword upstreamdat_Parameter NFSBELOW 
+syn keyword upstreamdat_Parameter NODATAOK 
+syn keyword upstreamdat_Parameter NODIRFORINCREMENTAL 
+syn keyword upstreamdat_Parameter NODIRFORINCREMENTAL 
+syn keyword upstreamdat_Parameter NONFILEDATABITMAP 
+syn keyword upstreamdat_Parameter NONFILEDATABITMAP 
+syn keyword upstreamdat_Parameter NOPOINTRESTORE 
+syn keyword upstreamdat_Parameter NOSPECINHERITANCE 
+syn keyword upstreamdat_Parameter NOTIFYEVENTS 
+syn keyword upstreamdat_Parameter NOTIFYFAILUREATTACHMENT 
+syn keyword upstreamdat_Parameter NOTIFYSUCCESSATTACHMENT 
+syn keyword upstreamdat_Parameter NOTIFYTARGETS 
+syn keyword upstreamdat_Parameter NOUIDGIDNAMES 
+syn keyword upstreamdat_Parameter NOUIDGIDNAMES 
+syn keyword upstreamdat_Parameter NOVELLMIGRATE 
+syn keyword upstreamdat_Parameter NOVELLMIGRATE 
+syn keyword upstreamdat_Parameter NOVELLMIGRATEADDEXT 
+syn keyword upstreamdat_Parameter NOVELLMIGRATEADDEXT 
+syn keyword upstreamdat_Parameter NOVELLPROFILE 
+syn keyword upstreamdat_Parameter NOVELLRECALL 
+syn keyword upstreamdat_Parameter NTFSADDPERMISSION 
+syn keyword upstreamdat_Parameter NTFSADDPERMISSION 
+syn keyword upstreamdat_Parameter NTREGRESTORE 
+syn keyword upstreamdat_Parameter OSTYPE 
+syn keyword upstreamdat_Parameter OUTPORT 
+syn keyword upstreamdat_Parameter PACKFLUSHAFTERFILE 
+syn keyword upstreamdat_Parameter PACKRECSIZE 
+syn keyword upstreamdat_Parameter PARAMETER 
+syn keyword upstreamdat_Parameter PASSWORD 
+syn keyword upstreamdat_Parameter PATHNAME 
+syn keyword upstreamdat_Parameter PATHNAME 
+syn keyword upstreamdat_Parameter PERFORMBITMAP 
+syn keyword upstreamdat_Parameter PERFORMNUMRECORDS 
+syn keyword upstreamdat_Parameter PERFORMRECORDSIZE 
+syn keyword upstreamdat_Parameter PLUGIN 
+syn keyword upstreamdat_Parameter PLUGIN 
+syn keyword upstreamdat_Parameter PLUGINPARAMETERS 
+syn keyword upstreamdat_Parameter PLUGINPARAMETERS 
+syn keyword upstreamdat_Parameter POSTJOB 
+syn keyword upstreamdat_Parameter PREJOB 
+syn keyword upstreamdat_Parameter PRTYCLASS 
+syn keyword upstreamdat_Parameter PRTYLEVEL 
+syn keyword upstreamdat_Parameter RECALLCLEANUP 
+syn keyword upstreamdat_Parameter RECALLOFFLINEFILES 
+syn keyword upstreamdat_Parameter RECALLOFFLINEFILES 
+syn keyword upstreamdat_Parameter RECORDSIZE 
+syn keyword upstreamdat_Parameter REMOTEADDR 
+syn keyword upstreamdat_Parameter REMOTEAPPLPREF 
+syn keyword upstreamdat_Parameter REMOTEAPPLRETRY 
+syn keyword upstreamdat_Parameter REMOTECONNECTTYPE 
+syn keyword upstreamdat_Parameter REMOTEFLAGS 
+syn keyword upstreamdat_Parameter REMOTEIPADAPTER 
+syn keyword upstreamdat_Parameter REMOTELOCALPARAMETERS 
+syn keyword upstreamdat_Parameter REMOTELOGMODE 
+syn keyword upstreamdat_Parameter REMOTELUNAME 
+syn keyword upstreamdat_Parameter REMOTEMAXRETRIES 
+syn keyword upstreamdat_Parameter REMOTEMODENAME 
+syn keyword upstreamdat_Parameter REMOTEPARAMETERFILE 
+syn keyword upstreamdat_Parameter REMOTEPORT 
+syn keyword upstreamdat_Parameter REMOTEREQUEST 
+syn keyword upstreamdat_Parameter REMOTERESTART 
+syn keyword upstreamdat_Parameter REMOTEROUTE 
+syn keyword upstreamdat_Parameter REMOTETARGETNAME 
+syn keyword upstreamdat_Parameter REMOTETCP 
+syn keyword upstreamdat_Parameter REMOTETIMEOUT 
+syn keyword upstreamdat_Parameter REMOTETMAXRETRY 
+syn keyword upstreamdat_Parameter REMOTETPN 
+syn keyword upstreamdat_Parameter REMOTEUSAPPL 
+syn keyword upstreamdat_Parameter REMOTEVERIFY 
+syn keyword upstreamdat_Parameter REMOTEWTOCOMP 
+syn keyword upstreamdat_Parameter REPORTNAME 
+syn keyword upstreamdat_Parameter REPORTOPTIONS 
+syn keyword upstreamdat_Parameter RESTARTLASTFILE 
+syn keyword upstreamdat_Parameter RESTART 
+syn keyword upstreamdat_Parameter RESTARTTYPE 
+syn keyword upstreamdat_Parameter RESTARTVERSIONDATE 
+syn keyword upstreamdat_Parameter RESTOREARCHIVEBIT 
+syn keyword upstreamdat_Parameter RESTORECHECKPOINT 
+syn keyword upstreamdat_Parameter RESTOREDATELIMIT 
+syn keyword upstreamdat_Parameter RESTOREDATELIMIT 
+syn keyword upstreamdat_Parameter RESTOREFILEFAIL 
+syn keyword upstreamdat_Parameter RESTOREMOUNTPOINTS 
+syn keyword upstreamdat_Parameter RESTOREMOUNTPOINTS 
+syn keyword upstreamdat_Parameter RESTORESEGMENTS 
+syn keyword upstreamdat_Parameter RESTORESEGMENTS 
+syn keyword upstreamdat_Parameter RESTORETODIFFFS 
+syn keyword upstreamdat_Parameter RETAIN 
+syn keyword upstreamdat_Parameter RETAIN 
+syn keyword upstreamdat_Parameter ROOTENTRY 
+syn keyword upstreamdat_Parameter ROOTENTRY 
+syn keyword upstreamdat_Parameter SAN 
+syn keyword upstreamdat_Parameter SCHEDULENAME 
+syn keyword upstreamdat_Parameter SEGMENTEDFILESIZE 
+syn keyword upstreamdat_Parameter SEGMENTEDFILESIZE 
+syn keyword upstreamdat_Parameter SEGMENTSIZE 
+syn keyword upstreamdat_Parameter SEGMENTSIZE 
+syn keyword upstreamdat_Parameter SENDHOSTDETAILS 
+syn keyword upstreamdat_Parameter SINGLEFS 
+syn keyword upstreamdat_Parameter SIZETRC 
+syn keyword upstreamdat_Parameter SKIP 
+syn keyword upstreamdat_Parameter SKIPBACKUPSCAN 
+syn keyword upstreamdat_Parameter SKIPOLD 
+syn keyword upstreamdat_Parameter SKIPOLD 
+syn keyword upstreamdat_Parameter SMSTARGETSERVICENAME 
+syn keyword upstreamdat_Parameter SMSTSA 
+syn keyword upstreamdat_Parameter SOLO 
+syn keyword upstreamdat_Parameter SORTBACKUP 
+syn keyword upstreamdat_Parameter SOSDISK 
+syn keyword upstreamdat_Parameter SOSDISK 
+syn keyword upstreamdat_Parameter SOSTIMESTAMP 
+syn keyword upstreamdat_Parameter SOSTIMESTAMP 
+syn keyword upstreamdat_Parameter SOSTIMESTAMPPATH 
+syn keyword upstreamdat_Parameter SOSTIMESTAMPPATH 
+syn keyword upstreamdat_Parameter SPECNUMBER 
+syn keyword upstreamdat_Parameter SPECNUMBER 
+syn keyword upstreamdat_Parameter SPECTYPE 
+syn keyword upstreamdat_Parameter SPECTYPE 
+syn keyword upstreamdat_Parameter STARTTIME 
+syn keyword upstreamdat_Parameter STORAGETYPE 
+syn keyword upstreamdat_Parameter SUBDIRECTORIES 
+syn keyword upstreamdat_Parameter SUBDIRECTORIES 
+syn keyword upstreamdat_Parameter SWITCHTOTAPEMB 
+syn keyword upstreamdat_Parameter TCPADDRESS 
+syn keyword upstreamdat_Parameter TCPTIMEOUT 
+syn keyword upstreamdat_Parameter TIMEOVERRIDE 
+syn keyword upstreamdat_Parameter TRACE 
+syn keyword upstreamdat_Parameter TRANSLATE 
+syn keyword upstreamdat_Parameter ULTRACOMP 
+syn keyword upstreamdat_Parameter ULTREG 
+syn keyword upstreamdat_Parameter ULTUPD 
+syn keyword upstreamdat_Parameter UNCMACHINEALIAS 
+syn keyword upstreamdat_Parameter UNCMACHINEALIAS 
+syn keyword upstreamdat_Parameter USEALEBRA 
+syn keyword upstreamdat_Parameter USECONTROLFILE 
+syn keyword upstreamdat_Parameter USEGID 
+syn keyword upstreamdat_Parameter USERID 
+syn keyword upstreamdat_Parameter USEUID 
+syn keyword upstreamdat_Parameter USNOUIDGIDERRORS 
+syn keyword upstreamdat_Parameter UTF8 
+syn keyword upstreamdat_Parameter VAULTNUMBER 
+syn keyword upstreamdat_Parameter VERSIONDATE 
+syn keyword upstreamdat_Parameter WRITESPARSE 
+syn keyword upstreamdat_Parameter XFERECORDSIZE 
+syn keyword upstreamdat_Parameter XFERRECSEP 
+syn keyword upstreamdat_Parameter XFERRECUSECR 
+
+hi def link upstreamdat_Parameter Type
+
+let b:current_syntax = "upstreamdat"
diff --git a/runtime/syntax/upstreaminstalllog.vim b/runtime/syntax/upstreaminstalllog.vim
new file mode 100644
index 0000000000..fb23fdcca0
--- /dev/null
+++ b/runtime/syntax/upstreaminstalllog.vim
@@ -0,0 +1,27 @@
+" Vim syntax file
+" Language:             Innovation Data Processing UPSTREAMInstall.log file
+" Maintainer:           Rob Owens 
+" Latest Revision:      2013-06-17
+
+" Quit when a syntax file was already loaded
+if exists("b:current_syntax")
+  finish
+endif
+
+" Date:
+syn match upstreaminstalllog_Date /\u\l\l \u\l\l\s\{1,2}\d\{1,2} \d\d:\d\d:\d\d \d\d\d\d/
+" Msg Types:
+syn match upstreaminstalllog_MsgD /Msg #MSI\d\{4,5}D/
+syn match upstreaminstalllog_MsgE /Msg #MSI\d\{4,5}E/
+syn match upstreaminstalllog_MsgI /Msg #MSI\d\{4,5}I/
+syn match upstreaminstalllog_MsgW /Msg #MSI\d\{4,5}W/
+" IP Address:
+syn match upstreaminstalllog_IPaddr / \d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/
+
+hi def link upstreaminstalllog_Date	Underlined
+hi def link upstreaminstalllog_MsgD	Type
+hi def link upstreaminstalllog_MsgE	Error
+hi def link upstreaminstalllog_MsgW	Constant
+hi def link upstreaminstalllog_IPaddr	Identifier
+
+let b:current_syntax = "upstreaminstalllog"
diff --git a/runtime/syntax/upstreamlog.vim b/runtime/syntax/upstreamlog.vim
new file mode 100644
index 0000000000..343b4a257b
--- /dev/null
+++ b/runtime/syntax/upstreamlog.vim
@@ -0,0 +1,42 @@
+" Vim syntax file
+" Language:             Innovation Data Processing upstream.log file
+" Maintainer:           Rob Owens 
+" Latest Revision:      2013-06-17
+
+" Quit when a syntax file was already loaded
+if exists("b:current_syntax")
+  finish
+endif
+
+" Date:
+syn match upstreamlog_Date /\u\l\l \u\l\l\s\{1,2}\d\{1,2} \d\d:\d\d:\d\d \d\d\d\d/
+" Msg Types:
+syn match upstreamlog_MsgD /Msg #\(Agt\|PC\|Srv\)\d\{4,5}D/ nextgroup=upstreamlog_Process skipwhite
+syn match upstreamlog_MsgE /Msg #\(Agt\|PC\|Srv\)\d\{4,5}E/ nextgroup=upstreamlog_Process skipwhite
+syn match upstreamlog_MsgI /Msg #\(Agt\|PC\|Srv\)\d\{4,5}I/ nextgroup=upstreamlog_Process skipwhite
+syn match upstreamlog_MsgW /Msg #\(Agt\|PC\|Srv\)\d\{4,5}W/ nextgroup=upstreamlog_Process skipwhite
+" Processes:
+syn region upstreamlog_Process start="(" end=")" contained
+" IP Address:
+syn match upstreamlog_IPaddr / \d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/
+" Profile:
+syn region upstreamlog_Profile start="Profile name \zs" end="\"\S\{1,8}\""
+syn region upstreamlog_Profile start=" Profile: \zs" end="\S\{1,8}"
+syn region upstreamlog_Profile start="  Profile: \zs" end="\ze, "
+syn region upstreamlog_Profile start="Backup Profile: \zs" end="\ze Version date"
+syn region upstreamlog_Profile start="Full of \zs" end="\ze$"
+syn region upstreamlog_Profile start="Incr. of \zs" end="\ze$"
+" Target:
+syn region upstreamlog_Target start="Computer: \zs" end="\ze[\]\)]" 
+syn region upstreamlog_Target start="Computer name \zs" end="\ze," 
+
+hi def link upstreamlog_Date	Underlined
+hi def link upstreamlog_MsgD	Type
+hi def link upstreamlog_MsgE	Error
+hi def link upstreamlog_MsgW	Constant
+hi def link upstreamlog_Process	Statement
+hi def link upstreamlog_IPaddr	Identifier
+hi def link upstreamlog_Profile	Identifier
+hi def link upstreamlog_Target	Identifier
+
+let b:current_syntax = "upstreamlog"
diff --git a/runtime/syntax/usserverlog.vim b/runtime/syntax/usserverlog.vim
new file mode 100644
index 0000000000..28105cc3bb
--- /dev/null
+++ b/runtime/syntax/usserverlog.vim
@@ -0,0 +1,48 @@
+" Vim syntax file
+" Language:             Innovation Data Processing usserver.log file
+" Maintainer:           Rob Owens 
+" Latest Revision:      2013-06-17
+
+" Quit when a syntax file was already loaded
+if exists("b:current_syntax")
+  finish
+endif
+
+" Date:
+syn match usserver_Date /\u\l\l \u\l\l\s\{1,2}\d\{1,2} \d\d:\d\d:\d\d \d\d\d\d/
+" Msg Types:
+syn match usserver_MsgD /Msg #\(Agt\|PC\|Srv\)\d\{4,5}D/ nextgroup=usserver_Process skipwhite
+syn match usserver_MsgE /Msg #\(Agt\|PC\|Srv\)\d\{4,5}E/ nextgroup=usserver_Process skipwhite
+syn match usserver_MsgI /Msg #\(Agt\|PC\|Srv\)\d\{4,5}I/ nextgroup=usserver_Process skipwhite
+syn match usserver_MsgW /Msg #\(Agt\|PC\|Srv\)\d\{4,5}W/ nextgroup=usserver_Process skipwhite
+" Processes:
+syn region usserver_Process start="(" end=")" contained
+" IP Address:
+syn match usserver_IPaddr /\( \|(\)\zs\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/
+" Profile:
+syn region usserver_Profile start="Profile name \zs" end="\"\S\{1,8}\""
+syn region usserver_Profile start=" Profile: \zs" end="\S\{1,8}"
+syn region usserver_Profile start=", profile: \zs" end="\S\{1,8}\ze,"
+syn region usserver_Profile start=" profile \zs" end="\S\{1,8}"
+syn region usserver_Profile start="  Profile: \zs" end="\ze, "
+syn region usserver_Profile start="Backup Profile: \zs" end="\ze Version date"
+syn region usserver_Profile start="Full of \zs" end="\ze$"
+syn region usserver_Profile start="Incr. of \zs" end="\ze$"
+syn region usserver_Profile start="Profile=\zs" end="\S\{1,8}\ze,"
+" Target:
+syn region usserver_Target start="Computer: \zs" end="\ze[\]\)]" 
+syn region usserver_Target start="Computer name \zs" end="\ze," 
+syn region usserver_Target start="Registration add request successful \zs" end="$"
+syn region usserver_Target start="request to registered name \zs" end=" "
+syn region usserver_Target start=", sending to \zs" end="$"
+
+hi def link usserver_Date	Underlined
+hi def link usserver_MsgD	Type
+hi def link usserver_MsgE	Error
+hi def link usserver_MsgW	Constant
+hi def link usserver_Process	Statement
+hi def link usserver_IPaddr	Identifier
+hi def link usserver_Profile	Identifier
+hi def link usserver_Target	Identifier
+
+let b:current_syntax = "usserver"
diff --git a/runtime/syntax/usw2kagtlog.vim b/runtime/syntax/usw2kagtlog.vim
new file mode 100644
index 0000000000..b241f16916
--- /dev/null
+++ b/runtime/syntax/usw2kagtlog.vim
@@ -0,0 +1,48 @@
+" Vim syntax file
+" Language:             Innovation Data Processing USW2KAgt.log file
+" Maintainer:           Rob Owens 
+" Latest Revision:      2013-06-17
+
+" Quit when a syntax file was already loaded
+if exists("b:current_syntax")
+  finish
+endif
+
+" Date:
+syn match usw2kagentlog_Date /\u\l\l \u\l\l\s\{1,2}\d\{1,2} \d\d:\d\d:\d\d \d\d\d\d/
+" Msg Types:
+syn match usw2kagentlog_MsgD /Msg #\(Agt\|PC\|Srv\)\d\{4,5}D/ nextgroup=usw2kagentlog_Process skipwhite
+syn match usw2kagentlog_MsgE /Msg #\(Agt\|PC\|Srv\)\d\{4,5}E/ nextgroup=usw2kagentlog_Process skipwhite
+syn match usw2kagentlog_MsgI /Msg #\(Agt\|PC\|Srv\)\d\{4,5}I/ nextgroup=usw2kagentlog_Process skipwhite
+syn match usw2kagentlog_MsgW /Msg #\(Agt\|PC\|Srv\)\d\{4,5}W/ nextgroup=usw2kagentlog_Process skipwhite
+" Processes:
+syn region usw2kagentlog_Process start="(" end=")" contained
+syn region usw2kagentlog_Process start="Starting the processing for a \zs\"" end="\ze client request"
+syn region usw2kagentlog_Process start="Ending the processing for a \zs\"" end="\ze client request"
+" IP Address:
+syn match usw2kagentlog_IPaddr / \d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/
+" Profile:
+syn region usw2kagentlog_Profile start="Profile name \zs" end="\"\S\{1,8}\""
+syn region usw2kagentlog_Profile start=" Profile: \zs" end="\S\{1,8}"
+syn region usw2kagentlog_Profile start="  Profile: \zs" end="\ze, "
+syn region usw2kagentlog_Profile start="Backup Profile: \zs" end="\ze Version date"
+syn region usw2kagentlog_Profile start="Full of \zs" end="\ze$"
+syn region usw2kagentlog_Profile start="Incr. of \zs" end="\ze$"
+syn region usw2kagentlog_Profile start="profile name \zs\"" end="\""
+" Target:
+syn region usw2kagentlog_Target start="Computer: \zs" end="\ze[\]\)]" 
+syn region usw2kagentlog_Target start="Computer name \zs" end="\ze," 
+" Agent Keywords:
+syn keyword usw2kagentlog_Agentword opened closed
+
+hi def link usw2kagentlog_Date		Underlined
+hi def link usw2kagentlog_MsgD		Type
+hi def link usw2kagentlog_MsgE		Error
+hi def link usw2kagentlog_MsgW		Constant
+hi def link usw2kagentlog_Process	Statement
+hi def link usw2kagentlog_IPaddr	Identifier
+hi def link usw2kagentlog_Profile	Identifier
+hi def link usw2kagentlog_Target	Identifier
+hi def link usw2kagentlog_Agentword	Special
+
+let b:current_syntax = "usw2kagentlog"
diff --git a/src/buffer.c b/src/buffer.c
index a86a5bb5b5..7d085920ea 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5106,7 +5106,8 @@ chk_modeline(lnum, flags)
 	    if ((prev != -1 && STRNCMP(s, "ex:", (size_t)3) == 0)
 		    || STRNCMP(s, "vi:", (size_t)3) == 0)
 		break;
-	    if (STRNCMP(s, "vim", 3) == 0)
+	    /* Accept both "vim" and "Vim". */
+	    if ((s[0] == 'v' || s[0] == 'V') && s[1] == 'i' && s[2] == 'm')
 	    {
 		if (s[3] == '<' || s[3] == '=' || s[3] == '>')
 		    e = s + 4;
diff --git a/src/eval.c b/src/eval.c
index 4085c83c4d..fc0053fe2b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -10449,7 +10449,7 @@ findfilendir(argvars, rettv, find_what)
     {
 	do
 	{
-	    if (rettv->v_type == VAR_STRING)
+	    if (rettv->v_type == VAR_STRING || rettv->v_type == VAR_LIST)
 		vim_free(fresult);
 	    fresult = find_file_in_path_option(first ? fname : NULL,
 					       first ? (int)STRLEN(fname) : 0,
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 9134c2d834..dbfcc873f2 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1708,13 +1708,13 @@ getcmdline(firstc, count, indent)
 	 * We come here if we have a normal character.
 	 */
 
-	if (do_abbr && (IS_SPECIAL(c) || !vim_iswordc(c)) && ccheck_abbr(
+	if (do_abbr && (IS_SPECIAL(c) || !vim_iswordc(c)) && (ccheck_abbr(
 #ifdef FEAT_MBYTE
 			/* Add ABBR_OFF for characters above 0x100, this is
 			 * what check_abbr() expects. */
 			(has_mbyte && c >= 0x100) ? (c + ABBR_OFF) :
 #endif
-									c))
+							 c) || c == Ctrl_RSB))
 	    goto cmdline_changed;
 
 	/*
diff --git a/src/fileio.c b/src/fileio.c
index 448836ad99..226cf5ad12 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -9610,6 +9610,12 @@ unblock_autocmds()
 # endif
 }
 
+    int
+is_autocmd_blocked()
+{
+    return autocmd_blocked != 0;
+}
+
 /*
  * Find next autocommand pattern that matches.
  */
diff --git a/src/gui_w32.c b/src/gui_w32.c
index c7a7b605cc..34d3dd4d91 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -3216,7 +3216,7 @@ gui_mch_dialog(
 	    if (l == 1 && vim_iswhite(*pend)
 					&& textWidth > maxDialogWidth * 3 / 4)
 		last_white = pend;
-	    textWidth += GetTextWidth(hdc, pend, l);
+	    textWidth += GetTextWidthEnc(hdc, pend, l);
 	    if (textWidth >= maxDialogWidth)
 	    {
 		/* Line will wrap. */
@@ -3282,7 +3282,7 @@ gui_mch_dialog(
 	    pend = vim_strchr(pstart, DLG_BUTTON_SEP);
 	    if (pend == NULL)
 		pend = pstart + STRLEN(pstart);	// Last button name.
-	    textWidth = GetTextWidth(hdc, pstart, (int)(pend - pstart));
+	    textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart));
 	    if (textWidth < minButtonWidth)
 		textWidth = minButtonWidth;
 	    textWidth += dlgPaddingX;	    /* Padding within button */
@@ -3307,7 +3307,7 @@ gui_mch_dialog(
 	    pend = vim_strchr(pstart, DLG_BUTTON_SEP);
 	    if (pend == NULL)
 		pend = pstart + STRLEN(pstart);	// Last button name.
-	    textWidth = GetTextWidth(hdc, pstart, (int)(pend - pstart));
+	    textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart));
 	    textWidth += dlgPaddingX;		/* Padding within button */
 	    textWidth += DLG_VERT_PADDING_X * 2; /* Padding around button */
 	    if (textWidth > dlgwidth)
diff --git a/src/if_py_both.h b/src/if_py_both.h
index e48740c275..b564d24b5d 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -37,16 +37,17 @@ static const char *vim_special_path = "_vim_path_";
 	: obj->ob_type->tp_name)
 
 #define RAISE_NO_EMPTY_KEYS PyErr_SET_STRING(PyExc_ValueError, \
-						"empty keys are not allowed")
-#define RAISE_LOCKED(type) PyErr_SET_VIM(_(type " is locked"))
-#define RAISE_LOCKED_DICTIONARY RAISE_LOCKED("dictionary")
-#define RAISE_LOCKED_LIST RAISE_LOCKED("list")
-#define RAISE_UNDO_FAIL PyErr_SET_VIM("cannot save undo information")
-#define RAISE_LINE_FAIL(act) PyErr_SET_VIM("cannot " act " line")
+					    N_("empty keys are not allowed"))
+#define RAISE_LOCKED_DICTIONARY PyErr_SET_VIM(N_("dictionary is locked"))
+#define RAISE_LOCKED_LIST PyErr_SET_VIM(N_("list is locked"))
+#define RAISE_UNDO_FAIL PyErr_SET_VIM(N_("cannot save undo information"))
+#define RAISE_DELETE_LINE_FAIL PyErr_SET_VIM(N_("cannot delete line"))
+#define RAISE_INSERT_LINE_FAIL PyErr_SET_VIM(N_("cannot insert line"))
+#define RAISE_REPLACE_LINE_FAIL PyErr_SET_VIM(N_("cannot replace line"))
 #define RAISE_KEY_ADD_FAIL(key) \
-    PyErr_VIM_FORMAT("failed to add key '%s' to dictionary", key)
+    PyErr_VIM_FORMAT(N_("failed to add key '%s' to dictionary"), key)
 #define RAISE_INVALID_INDEX_TYPE(idx) \
-    PyErr_FORMAT(PyExc_TypeError, "index must be int or slice, not %s", \
+    PyErr_FORMAT(PyExc_TypeError, N_("index must be int or slice, not %s"), \
 	    Py_TYPE_NAME(idx));
 
 #define INVALID_BUFFER_VALUE ((buf_T *)(-1))
@@ -138,13 +139,15 @@ StringToChars(PyObject *obj, PyObject **todecref)
     }
     else
     {
-	PyErr_FORMAT(PyExc_TypeError,
 #if PY_MAJOR_VERSION < 3
-		"expected str() or unicode() instance, but got %s"
+	PyErr_FORMAT(PyExc_TypeError,
+		N_("expected str() or unicode() instance, but got %s"),
+		Py_TYPE_NAME(obj));
 #else
-		"expected bytes() or str() instance, but got %s"
+	PyErr_FORMAT(PyExc_TypeError,
+		N_("expected bytes() or str() instance, but got %s"),
+		Py_TYPE_NAME(obj));
 #endif
-		, Py_TYPE_NAME(obj));
 	return NULL;
     }
 
@@ -190,15 +193,17 @@ NumberToLong(PyObject *obj, long *result, int flags)
     }
     else
     {
-	PyErr_FORMAT(PyExc_TypeError,
 #if PY_MAJOR_VERSION < 3
-		"expected int(), long() or something supporting "
-		"coercing to long(), but got %s"
+	PyErr_FORMAT(PyExc_TypeError,
+		N_("expected int(), long() or something supporting "
+		   "coercing to long(), but got %s"),
+		Py_TYPE_NAME(obj));
 #else
-		"expected int() or something supporting coercing to int(), "
-		"but got %s"
+	PyErr_FORMAT(PyExc_TypeError,
+		N_("expected int() or something supporting coercing to int(), "
+		   "but got %s"),
+		Py_TYPE_NAME(obj));
 #endif
-		, Py_TYPE_NAME(obj));
 	return -1;
     }
 
@@ -207,13 +212,13 @@ NumberToLong(PyObject *obj, long *result, int flags)
 	if (*result > INT_MAX)
 	{
 	    PyErr_SET_STRING(PyExc_OverflowError,
-		    "value is too large to fit into C int type");
+		    N_("value is too large to fit into C int type"));
 	    return -1;
 	}
 	else if (*result < INT_MIN)
 	{
 	    PyErr_SET_STRING(PyExc_OverflowError,
-		    "value is too small to fit into C int type");
+		    N_("value is too small to fit into C int type"));
 	    return -1;
 	}
     }
@@ -223,7 +228,7 @@ NumberToLong(PyObject *obj, long *result, int flags)
 	if (*result <= 0)
 	{
 	    PyErr_SET_STRING(PyExc_ValueError,
-		    "number must be greater then zero");
+		    N_("number must be greater then zero"));
 	    return -1;
 	}
     }
@@ -232,7 +237,7 @@ NumberToLong(PyObject *obj, long *result, int flags)
 	if (*result < 0)
 	{
 	    PyErr_SET_STRING(PyExc_ValueError,
-		    "number must be greater or equal to zero");
+		    N_("number must be greater or equal to zero"));
 	    return -1;
 	}
     }
@@ -326,7 +331,7 @@ OutputSetattr(OutputObject *self, char *name, PyObject *valObject)
     if (valObject == NULL)
     {
 	PyErr_SET_STRING(PyExc_AttributeError,
-		"can't delete OutputObject attributes");
+		N_("can't delete OutputObject attributes"));
 	return -1;
     }
 
@@ -337,7 +342,7 @@ OutputSetattr(OutputObject *self, char *name, PyObject *valObject)
 	return 0;
     }
 
-    PyErr_FORMAT(PyExc_AttributeError, "invalid attribute: %s", name);
+    PyErr_FORMAT(PyExc_AttributeError, N_("invalid attribute: %s"), name);
     return -1;
 }
 
@@ -785,7 +790,7 @@ VimEval(PyObject *self UNUSED, PyObject *args)
 
     if (our_tv == NULL)
     {
-	PyErr_SET_VIM("invalid expression");
+	PyErr_SET_VIM(N_("invalid expression"));
 	return NULL;
     }
 
@@ -836,7 +841,7 @@ VimEvalPy(PyObject *self UNUSED, PyObject *string)
 
     if (our_tv == NULL)
     {
-	PyErr_SET_VIM("invalid expression");
+	PyErr_SET_VIM(N_("invalid expression"));
 	return NULL;
     }
 
@@ -908,7 +913,7 @@ _VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs)
 	if (VimTryEnd())
 	    return NULL;
 
-	PyErr_SET_VIM("failed to change directory");
+	PyErr_SET_VIM(N_("failed to change directory"));
 	return NULL;
     }
 
@@ -1086,15 +1091,15 @@ call_load_module(char *name, int len, PyObject *find_module_result)
     if (!PyTuple_Check(find_module_result))
     {
 	PyErr_FORMAT(PyExc_TypeError,
-		"expected 3-tuple as imp.find_module() result, but got %s",
+		N_("expected 3-tuple as imp.find_module() result, but got %s"),
 		Py_TYPE_NAME(find_module_result));
 	return NULL;
     }
     if (PyTuple_GET_SIZE(find_module_result) != 3)
     {
 	PyErr_FORMAT(PyExc_TypeError,
-		"expected 3-tuple as imp.find_module() result, but got "
-		"tuple of size %d",
+		N_("expected 3-tuple as imp.find_module() result, but got "
+		   "tuple of size %d"),
 		(int) PyTuple_GET_SIZE(find_module_result));
 	return NULL;
     }
@@ -1104,7 +1109,7 @@ call_load_module(char *name, int len, PyObject *find_module_result)
 	    || !(description = PyTuple_GET_ITEM(find_module_result, 2)))
     {
 	PyErr_SET_STRING(PyExc_RuntimeError,
-		"internal error: imp.find_module returned tuple with NULL");
+		N_("internal error: imp.find_module returned tuple with NULL"));
 	return NULL;
     }
 
@@ -1198,6 +1203,14 @@ FinderFindModule(PyObject *self, PyObject *args)
 
     if (!module)
     {
+	if (PyErr_Occurred())
+	{
+	    if (PyErr_ExceptionMatches(PyExc_ImportError))
+		PyErr_Clear();
+	    else
+		return NULL;
+	}
+
 	Py_INCREF(Py_None);
 	return Py_None;
     }
@@ -1476,7 +1489,7 @@ DictionarySetattr(DictionaryObject *self, char *name, PyObject *valObject)
     if (valObject == NULL)
     {
 	PyErr_SET_STRING(PyExc_AttributeError,
-		"cannot delete vim.Dictionary attributes");
+		N_("cannot delete vim.Dictionary attributes"));
 	return -1;
     }
 
@@ -1484,7 +1497,8 @@ DictionarySetattr(DictionaryObject *self, char *name, PyObject *valObject)
     {
 	if (self->dict->dv_lock == VAR_FIXED)
 	{
-	    PyErr_SET_STRING(PyExc_TypeError, "cannot modify fixed dictionary");
+	    PyErr_SET_STRING(PyExc_TypeError,
+		    N_("cannot modify fixed dictionary"));
 	    return -1;
 	}
 	else
@@ -1501,7 +1515,7 @@ DictionarySetattr(DictionaryObject *self, char *name, PyObject *valObject)
     }
     else
     {
-	PyErr_FORMAT(PyExc_AttributeError, "cannot set attribute %s", name);
+	PyErr_FORMAT(PyExc_AttributeError, N_("cannot set attribute %s"), name);
 	return -1;
     }
 }
@@ -1609,7 +1623,7 @@ DictionaryContains(DictionaryObject *self, PyObject *keyObject)
 
     ret = (rObj == Py_True);
 
-    Py_DECREF(Py_True);
+    Py_DECREF(rObj);
 
     return ret;
 }
@@ -1635,7 +1649,7 @@ DictionaryIterNext(dictiterinfo_T **dii)
 	    (*dii)->ht->ht_used != (*dii)->ht_used)
     {
 	PyErr_SET_STRING(PyExc_RuntimeError,
-		"hashtab changed during iteration");
+		N_("hashtab changed during iteration"));
 	return NULL;
     }
 
@@ -1906,9 +1920,9 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs)
 		    Py_DECREF(iterator);
 		    Py_DECREF(fast);
 		    PyErr_FORMAT(PyExc_ValueError,
-			    "expected sequence element of size 2, "
-			    "but got sequence of size %d",
-			    PySequence_Fast_GET_SIZE(fast));
+			    N_("expected sequence element of size 2, "
+			    "but got sequence of size %d"),
+			    (int) PySequence_Fast_GET_SIZE(fast));
 		    return NULL;
 		}
 
@@ -2150,7 +2164,7 @@ ListConstructor(PyTypeObject *subtype, PyObject *args, PyObject *kwargs)
     if (kwargs)
     {
 	PyErr_SET_STRING(PyExc_TypeError,
-		"list constructor does not accept keyword arguments");
+		N_("list constructor does not accept keyword arguments"));
 	return NULL;
     }
 
@@ -2205,14 +2219,14 @@ ListItem(ListObject *self, Py_ssize_t index)
 
     if (index >= ListLength(self))
     {
-	PyErr_SET_STRING(PyExc_IndexError, "list index out of range");
+	PyErr_SET_STRING(PyExc_IndexError, N_("list index out of range"));
 	return NULL;
     }
     li = list_find(self->list, (long) index);
     if (li == NULL)
     {
 	/* No more suitable format specifications in python-2.3 */
-	PyErr_VIM_FORMAT("internal error: failed to get vim list item %d",
+	PyErr_VIM_FORMAT(N_("internal error: failed to get vim list item %d"),
 		(int) index);
 	return NULL;
     }
@@ -2331,7 +2345,7 @@ ListAssItem(ListObject *self, Py_ssize_t index, PyObject *obj)
     }
     if (index > length || (index == length && obj == NULL))
     {
-	PyErr_SET_STRING(PyExc_IndexError, "list index out of range");
+	PyErr_SET_STRING(PyExc_IndexError, N_("list index out of range"));
 	return -1;
     }
 
@@ -2352,7 +2366,7 @@ ListAssItem(ListObject *self, Py_ssize_t index, PyObject *obj)
 	if (list_append_tv(l, &tv) == FAIL)
 	{
 	    clear_tv(&tv);
-	    PyErr_SET_VIM("failed to add item to list");
+	    PyErr_SET_VIM(N_("failed to add item to list"));
 	    return -1;
 	}
     }
@@ -2393,7 +2407,8 @@ ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj)
 	li = list_find(l, (long) first);
 	if (li == NULL)
 	{
-	    PyErr_VIM_FORMAT("internal error: no vim list item %d", (int)first);
+	    PyErr_VIM_FORMAT(N_("internal error: no vim list item %d"),
+		    (int)first);
 	    return -1;
 	}
 	if (last > first)
@@ -2426,12 +2441,16 @@ ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj)
 	if (list_insert_tv(l, &v, li) == FAIL)
 	{
 	    clear_tv(&v);
-	    PyErr_SET_VIM("internal error: failed to add item to list");
+	    PyErr_SET_VIM(N_("internal error: failed to add item to list"));
 	    return -1;
 	}
 	clear_tv(&v);
     }
     Py_DECREF(iterator);
+
+    if (PyErr_Occurred())
+	return -1;
+
     return 0;
 }
 
@@ -2478,7 +2497,7 @@ ListSetattr(ListObject *self, char *name, PyObject *valObject)
     if (valObject == NULL)
     {
 	PyErr_SET_STRING(PyExc_AttributeError,
-		"cannot delete vim.List attributes");
+		N_("cannot delete vim.List attributes"));
 	return -1;
     }
 
@@ -2486,7 +2505,7 @@ ListSetattr(ListObject *self, char *name, PyObject *valObject)
     {
 	if (self->list->lv_lock == VAR_FIXED)
 	{
-	    PyErr_SET_STRING(PyExc_TypeError, "cannot modify fixed list");
+	    PyErr_SET_STRING(PyExc_TypeError, N_("cannot modify fixed list"));
 	    return -1;
 	}
 	else
@@ -2503,7 +2522,7 @@ ListSetattr(ListObject *self, char *name, PyObject *valObject)
     }
     else
     {
-	PyErr_FORMAT(PyExc_AttributeError, "cannot set attribute %s", name);
+	PyErr_FORMAT(PyExc_AttributeError, N_("cannot set attribute %s"), name);
 	return -1;
     }
 }
@@ -2539,7 +2558,7 @@ FunctionNew(PyTypeObject *subtype, char_u *name)
 	if (!translated_function_exists(name))
 	{
 	    PyErr_FORMAT(PyExc_ValueError,
-		    "unnamed function %s does not exist", name);
+		    N_("unnamed function %s does not exist"), name);
 	    return NULL;
 	}
 	self->name = vim_strsave(name);
@@ -2550,7 +2569,8 @@ FunctionNew(PyTypeObject *subtype, char_u *name)
 				    vim_strchr(name, AUTOLOAD_CHAR) == NULL))
 		== NULL)
 	{
-	    PyErr_FORMAT(PyExc_ValueError, "function %s does not exist", name);
+	    PyErr_FORMAT(PyExc_ValueError,
+		    N_("function %s does not exist"), name);
 	    return NULL;
 	}
 
@@ -2566,7 +2586,7 @@ FunctionConstructor(PyTypeObject *subtype, PyObject *args, PyObject *kwargs)
     if (kwargs)
     {
 	PyErr_SET_STRING(PyExc_TypeError,
-		"function constructor does not accept keyword arguments");
+		N_("function constructor does not accept keyword arguments"));
 	return NULL;
     }
 
@@ -2643,7 +2663,7 @@ FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs)
     else if (error != OK)
     {
 	ret = NULL;
-	PyErr_VIM_FORMAT("failed to run function %s", (char *)name);
+	PyErr_VIM_FORMAT(N_("failed to run function %s"), (char *)name);
     }
     else
 	ret = ConvertToPyObject(&rettv);
@@ -2796,13 +2816,13 @@ OptionsItem(OptionsObject *self, PyObject *keyObject)
 	else
 	{
 	    PyErr_SET_STRING(PyExc_RuntimeError,
-		    "unable to get option value");
+		    N_("unable to get option value"));
 	    return NULL;
 	}
     }
     else
     {
-	PyErr_SET_VIM("internal error: unknown option type");
+	PyErr_SET_VIM(N_("internal error: unknown option type"));
 	return NULL;
     }
 }
@@ -2845,7 +2865,7 @@ set_option_value_for(
 	    {
 		if (VimTryEnd())
 		    return -1;
-		PyErr_SET_VIM("problem while switching windows");
+		PyErr_SET_VIM(N_("problem while switching windows"));
 		return -1;
 	    }
 	    set_ret = set_option_value_err(key, numval, stringval, opt_flags);
@@ -2902,15 +2922,15 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
 	if (self->opt_type == SREQ_GLOBAL)
 	{
 	    PyErr_FORMAT(PyExc_ValueError,
-		    "unable to unset global option %s", key);
+		    N_("unable to unset global option %s"), key);
 	    Py_XDECREF(todecref);
 	    return -1;
 	}
 	else if (!(flags & SOPT_GLOBAL))
 	{
 	    PyErr_FORMAT(PyExc_ValueError,
-		    "unable to unset option %s "
-		    "which does not have global value", key);
+		    N_("unable to unset option %s "
+		       "which does not have global value"), key);
 	    Py_XDECREF(todecref);
 	    return -1;
 	}
@@ -2988,7 +3008,7 @@ CheckTabPage(TabPageObject *self)
 {
     if (self->tab == INVALID_TABPAGE_VALUE)
     {
-	PyErr_SET_VIM("attempt to refer to deleted tab page");
+	PyErr_SET_VIM(N_("attempt to refer to deleted tab page"));
 	return -1;
     }
 
@@ -3132,7 +3152,7 @@ TabListItem(PyObject *self UNUSED, PyInt n)
 	if (n == 0)
 	    return TabPageNew(tp);
 
-    PyErr_SET_STRING(PyExc_IndexError, "no such tab page");
+    PyErr_SET_STRING(PyExc_IndexError, N_("no such tab page"));
     return NULL;
 }
 
@@ -3154,7 +3174,7 @@ CheckWindow(WindowObject *self)
 {
     if (self->win == INVALID_WINDOW_VALUE)
     {
-	PyErr_SET_VIM("attempt to refer to deleted window");
+	PyErr_SET_VIM(N_("attempt to refer to deleted window"));
 	return -1;
     }
 
@@ -3320,7 +3340,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject)
 
     if (strcmp(name, "buffer") == 0)
     {
-	PyErr_SET_STRING(PyExc_TypeError, "readonly attribute: buffer");
+	PyErr_SET_STRING(PyExc_TypeError, N_("readonly attribute: buffer"));
 	return -1;
     }
     else if (strcmp(name, "cursor") == 0)
@@ -3333,7 +3353,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject)
 
 	if (lnum <= 0 || lnum > self->win->w_buffer->b_ml.ml_line_count)
 	{
-	    PyErr_SET_VIM("cursor position outside buffer");
+	    PyErr_SET_VIM(N_("cursor position outside buffer"));
 	    return -1;
 	}
 
@@ -3357,7 +3377,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject)
 	long	height;
 	win_T	*savewin;
 
-	if (NumberToLong(valObject, &height, NUMBER_INT))
+	if (NumberToLong(valObject, &height, NUMBER_INT|NUMBER_UNSIGNED))
 	    return -1;
 
 #ifdef FEAT_GUI
@@ -3380,7 +3400,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject)
 	long	width;
 	win_T	*savewin;
 
-	if (NumberToLong(valObject, &width, NUMBER_INT))
+	if (NumberToLong(valObject, &width, NUMBER_INT|NUMBER_UNSIGNED))
 	    return -1;
 
 #ifdef FEAT_GUI
@@ -3496,7 +3516,7 @@ WinListItem(WinListObject *self, PyInt n)
 	if (n == 0)
 	    return WindowNew(w, self->tabObject? self->tabObject->tab: curtab);
 
-    PyErr_SET_STRING(PyExc_IndexError, "no such window");
+    PyErr_SET_STRING(PyExc_IndexError, N_("no such window"));
     return NULL;
 }
 
@@ -3514,7 +3534,7 @@ StringToLine(PyObject *obj)
     char	*str;
     char	*save;
     PyObject	*bytes = NULL;
-    Py_ssize_t	len;
+    Py_ssize_t	len = 0;
     PyInt	i;
     char	*p;
 
@@ -3529,13 +3549,26 @@ StringToLine(PyObject *obj)
 	if (!(bytes = PyUnicode_AsEncodedString(obj, ENC_OPT, NULL)))
 	    return NULL;
 
-	if(PyBytes_AsStringAndSize(bytes, &str, &len) == -1
+	if (PyBytes_AsStringAndSize(bytes, &str, &len) == -1
 		|| str == NULL)
 	{
 	    Py_DECREF(bytes);
 	    return NULL;
 	}
     }
+    else
+    {
+#if PY_MAJOR_VERSION < 3
+	PyErr_FORMAT(PyExc_TypeError,
+		N_("expected str() or unicode() instance, but got %s"),
+		Py_TYPE_NAME(obj));
+#else
+	PyErr_FORMAT(PyExc_TypeError,
+		N_("expected bytes() or str() instance, but got %s"),
+		Py_TYPE_NAME(obj));
+#endif
+	return NULL;
+    }
 
     /*
      * Error checking: String must not contain newlines, as we
@@ -3550,7 +3583,7 @@ StringToLine(PyObject *obj)
 	    --len;
 	else
 	{
-	    PyErr_SET_VIM("string cannot contain newlines");
+	    PyErr_SET_VIM(N_("string cannot contain newlines"));
 	    Py_XDECREF(bytes);
 	    return NULL;
 	}
@@ -3688,7 +3721,7 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change)
 	if (u_savedel((linenr_T)n, 1L) == FAIL)
 	    RAISE_UNDO_FAIL;
 	else if (ml_delete((linenr_T)n, FALSE) == FAIL)
-	    RAISE_LINE_FAIL("delete");
+	    RAISE_DELETE_LINE_FAIL;
 	else
 	{
 	    if (buf == savebuf)
@@ -3727,7 +3760,7 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change)
 	}
 	else if (ml_replace((linenr_T)n, (char_u *)save, FALSE) == FAIL)
 	{
-	    RAISE_LINE_FAIL("replace");
+	    RAISE_REPLACE_LINE_FAIL;
 	    vim_free(save);
 	}
 	else
@@ -3794,7 +3827,7 @@ SetBufferLineList(
 	    {
 		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
 		{
-		    RAISE_LINE_FAIL("delete");
+		    RAISE_DELETE_LINE_FAIL;
 		    break;
 		}
 	    }
@@ -3866,7 +3899,7 @@ SetBufferLineList(
 	    for (i = 0; i < old_len - new_len; ++i)
 		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
 		{
-		    RAISE_LINE_FAIL("delete");
+		    RAISE_DELETE_LINE_FAIL;
 		    break;
 		}
 	    extra -= i;
@@ -3882,7 +3915,7 @@ SetBufferLineList(
 		if (ml_replace((linenr_T)(lo+i), (char_u *)array[i], FALSE)
 								      == FAIL)
 		{
-		    RAISE_LINE_FAIL("replace");
+		    RAISE_REPLACE_LINE_FAIL;
 		    break;
 		}
 	}
@@ -3900,7 +3933,7 @@ SetBufferLineList(
 		if (ml_append((linenr_T)(lo + i - 1),
 					(char_u *)array[i], 0, FALSE) == FAIL)
 		{
-		    RAISE_LINE_FAIL("insert");
+		    RAISE_INSERT_LINE_FAIL;
 		    break;
 		}
 		vim_free(array[i]);
@@ -3979,7 +4012,7 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change)
 	if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
 	    RAISE_UNDO_FAIL;
 	else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL)
-	    RAISE_LINE_FAIL("insert");
+	    RAISE_INSERT_LINE_FAIL;
 	else
 	    appended_lines_mark((linenr_T)n, 1L);
 
@@ -4036,7 +4069,7 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change)
 		if (ml_append((linenr_T)(n + i),
 					(char_u *)array[i], 0, FALSE) == FAIL)
 		{
-		    RAISE_LINE_FAIL("insert");
+		    RAISE_INSERT_LINE_FAIL;
 
 		    /* Free the rest of the lines */
 		    while (i < size)
@@ -4089,7 +4122,7 @@ CheckBuffer(BufferObject *self)
 {
     if (self->buf == INVALID_BUFFER_VALUE)
     {
-	PyErr_SET_VIM("attempt to refer to deleted buffer");
+	PyErr_SET_VIM(N_("attempt to refer to deleted buffer"));
 	return -1;
     }
 
@@ -4110,7 +4143,7 @@ RBItem(BufferObject *self, PyInt n, PyInt start, PyInt end)
 
     if (n < 0 || n > end - start)
     {
-	PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
+	PyErr_SET_STRING(PyExc_IndexError, N_("line number out of range"));
 	return NULL;
     }
 
@@ -4166,7 +4199,7 @@ RBAsItem(
 
     if (n < 0 || n > end - start)
     {
-	PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
+	PyErr_SET_STRING(PyExc_IndexError, N_("line number out of range"));
 	return -1;
     }
 
@@ -4250,7 +4283,7 @@ RBAppend(
 
     if (n < 0 || n > max)
     {
-	PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
+	PyErr_SET_STRING(PyExc_IndexError, N_("line number out of range"));
 	return NULL;
     }
 
@@ -4533,7 +4566,7 @@ BufferSetattr(BufferObject *self, char *name, PyObject *valObject)
 
 	if (ren_ret == FAIL)
 	{
-	    PyErr_SET_VIM("failed to rename buffer");
+	    PyErr_SET_VIM(N_("failed to rename buffer"));
 	    return -1;
 	}
 	return 0;
@@ -4569,7 +4602,7 @@ BufferMark(BufferObject *self, PyObject *pmarkObject)
     if (pmark[0] == '\0' || pmark[1] != '\0')
     {
 	PyErr_SET_STRING(PyExc_ValueError,
-		"mark name must be a single character");
+		N_("mark name must be a single character"));
 	Py_XDECREF(todecref);
 	return NULL;
     }
@@ -4587,7 +4620,7 @@ BufferMark(BufferObject *self, PyObject *pmarkObject)
 
     if (posp == NULL)
     {
-	PyErr_SET_VIM("invalid mark name");
+	PyErr_SET_VIM(N_("invalid mark name"));
 	return NULL;
     }
 
@@ -4812,7 +4845,7 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject)
 	if (valObject->ob_type != &BufferType)
 	{
 	    PyErr_FORMAT(PyExc_TypeError,
-		    "expected vim.Buffer object, but got %s",
+		    N_("expected vim.Buffer object, but got %s"),
 		    Py_TYPE_NAME(valObject));
 	    return -1;
 	}
@@ -4826,7 +4859,7 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject)
 	{
 	    if (VimTryEnd())
 		return -1;
-	    PyErr_VIM_FORMAT("failed to switch to buffer %d", count);
+	    PyErr_VIM_FORMAT(N_("failed to switch to buffer %d"), count);
 	    return -1;
 	}
 
@@ -4839,7 +4872,7 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject)
 	if (valObject->ob_type != &WindowType)
 	{
 	    PyErr_FORMAT(PyExc_TypeError,
-		    "expected vim.Window object, but got %s",
+		    N_("expected vim.Window object, but got %s"),
 		    Py_TYPE_NAME(valObject));
 	    return -1;
 	}
@@ -4851,7 +4884,7 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject)
 	if (!count)
 	{
 	    PyErr_SET_STRING(PyExc_ValueError,
-		    "failed to find window in the current tab page");
+		    N_("failed to find window in the current tab page"));
 	    return -1;
 	}
 
@@ -4862,7 +4895,7 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject)
 	    if (VimTryEnd())
 		return -1;
 	    PyErr_SET_STRING(PyExc_RuntimeError,
-		    "did not switch to the specified window");
+		    N_("did not switch to the specified window"));
 	    return -1;
 	}
 
@@ -4873,7 +4906,7 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject)
 	if (valObject->ob_type != &TabPageType)
 	{
 	    PyErr_FORMAT(PyExc_TypeError,
-		    "expected vim.TabPage object, but got %s",
+		    N_("expected vim.TabPage object, but got %s"),
 		    Py_TYPE_NAME(valObject));
 	    return -1;
 	}
@@ -4888,7 +4921,7 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject)
 	    if (VimTryEnd())
 		return -1;
 	    PyErr_SET_STRING(PyExc_RuntimeError,
-		    "did not switch to the specified tab page");
+		    N_("did not switch to the specified tab page"));
 	    return -1;
 	}
 
@@ -5371,7 +5404,7 @@ ConvertFromPyMapping(PyObject *obj, typval_T *tv)
     else
     {
 	PyErr_FORMAT(PyExc_TypeError,
-		"unable to convert %s to vim dictionary",
+		N_("unable to convert %s to vim dictionary"),
 		Py_TYPE_NAME(obj));
 	ret = -1;
     }
@@ -5479,6 +5512,7 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
 #endif
     else if (PyObject_HasAttrString(obj, "keys"))
 	return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
+    /* PyObject_GetIter can create built-in iterator for any sequence object */
     else if (PyIter_Check(obj) || PySequence_Check(obj))
 	return convert_dl(obj, tv, pyseq_to_tv, lookup_dict);
     else if (PyMapping_Check(obj))
@@ -5498,7 +5532,7 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
     else
     {
 	PyErr_FORMAT(PyExc_TypeError,
-		"unable to convert %s to vim structure",
+		N_("unable to convert %s to vim structure"),
 		Py_TYPE_NAME(obj));
 	return -1;
     }
@@ -5510,7 +5544,7 @@ ConvertToPyObject(typval_T *tv)
 {
     if (tv == NULL)
     {
-	PyErr_SET_VIM("internal error: NULL reference passed");
+	PyErr_SET_VIM(N_("internal error: NULL reference passed"));
 	return NULL;
     }
     switch (tv->v_type)
@@ -5535,7 +5569,7 @@ ConvertToPyObject(typval_T *tv)
 	    Py_INCREF(Py_None);
 	    return Py_None;
 	default:
-	    PyErr_SET_VIM("internal error: invalid value type");
+	    PyErr_SET_VIM(N_("internal error: invalid value type"));
 	    return NULL;
     }
 }
@@ -5926,11 +5960,8 @@ static struct object_constant {
     {"_Loader",    (PyObject *)&LoaderType},
 };
 
-typedef int (*object_adder)(PyObject *, const char *, PyObject *);
-typedef PyObject *(*attr_getter)(PyObject *, const char *);
-
 #define ADD_OBJECT(m, name, obj) \
-    if (add_object(m, name, obj)) \
+    if (PyModule_AddObject(m, name, obj)) \
 	return -1;
 
 #define ADD_CHECKED_OBJECT(m, name, obj) \
@@ -5942,7 +5973,7 @@ typedef PyObject *(*attr_getter)(PyObject *, const char *);
     }
 
     static int
-populate_module(PyObject *m, object_adder add_object, attr_getter get_attr)
+populate_module(PyObject *m)
 {
     int		i;
     PyObject	*other_module;
@@ -5986,7 +6017,7 @@ populate_module(PyObject *m, object_adder add_object, attr_getter get_attr)
     if (!(py_chdir = PyObject_GetAttrString(other_module, "chdir")))
 	return -1;
     ADD_OBJECT(m, "_chdir", py_chdir);
-    if (!(attr = get_attr(m, "chdir")))
+    if (!(attr = PyObject_GetAttrString(m, "chdir")))
 	return -1;
     if (PyObject_SetAttrString(other_module, "chdir", attr))
     {
@@ -5998,7 +6029,7 @@ populate_module(PyObject *m, object_adder add_object, attr_getter get_attr)
     if ((py_fchdir = PyObject_GetAttrString(other_module, "fchdir")))
     {
 	ADD_OBJECT(m, "_fchdir", py_fchdir);
-	if (!(attr = get_attr(m, "fchdir")))
+	if (!(attr = PyObject_GetAttrString(m, "fchdir")))
 	    return -1;
 	if (PyObject_SetAttrString(other_module, "fchdir", attr))
 	{
diff --git a/src/if_python.c b/src/if_python.c
index bbd1040783..e5aec38214 100644
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -333,7 +333,7 @@ static PyTypeObject* dll_PyInt_Type;
 static PyTypeObject* dll_PyLong_Type;
 static PyObject*(*dll_PyList_GetItem)(PyObject *, PyInt);
 static int(*dll_PyList_Append)(PyObject *, PyObject *);
-static int(*dll_PyList_Insert)(PyObject *, int, PyObject *);
+static int(*dll_PyList_Insert)(PyObject *, PyInt, PyObject *);
 static PyObject*(*dll_PyList_New)(PyInt size);
 static int(*dll_PyList_SetItem)(PyObject *, PyInt, PyObject *);
 static PyInt(*dll_PyList_Size)(PyObject *);
@@ -369,7 +369,7 @@ static PyObject* (*dll_PyObject_CallFunction)(PyObject *, char *, ...);
 static PyObject* (*dll_PyObject_Call)(PyObject *, PyObject *, PyObject *);
 static PyObject* (*dll_PyObject_Repr)(PyObject *);
 static char*(*dll_PyString_AsString)(PyObject *);
-static int(*dll_PyString_AsStringAndSize)(PyObject *, char **, int *);
+static int(*dll_PyString_AsStringAndSize)(PyObject *, char **, PyInt *);
 static PyObject*(*dll_PyString_FromString)(const char *);
 static PyObject*(*dll_PyString_FromFormat)(const char *, ...);
 static PyObject*(*dll_PyString_FromStringAndSize)(const char *, PyInt);
@@ -1408,8 +1408,7 @@ PythonMod_Init(void)
     vim_module = Py_InitModule4("vim", VimMethods, (char *)NULL,
 				(PyObject *)NULL, PYTHON_API_VERSION);
 
-    if (populate_module(vim_module, PyModule_AddObject,
-			   PyObject_GetAttrString))
+    if (populate_module(vim_module))
 	return -1;
 
     if (init_sys_path())
diff --git a/src/if_python3.c b/src/if_python3.c
index 3d9a5ee4c9..badf015c20 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -1623,7 +1623,7 @@ Py3Init_vim(void)
     if ((vim_module = PyModule_Create(&vimmodule)) == NULL)
 	return NULL;
 
-    if (populate_module(vim_module, PyModule_AddObject, PyObject_GetAttrString))
+    if (populate_module(vim_module))
 	return NULL;
 
     if (init_sys_path())
diff --git a/src/mbyte.c b/src/mbyte.c
index f9dbb2fafe..842d39e1c9 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -4457,7 +4457,7 @@ im_set_active(int active)
 {
     int was_active;
 
-    was_active = !!im_is_active;
+    was_active = !!im_get_status();
     im_is_active = (active && !p_imdisable);
 
     if (im_is_active != was_active)
@@ -5138,44 +5138,25 @@ xim_reset(void)
 # ifndef FEAT_GUI_MACVIM
     if (xic != NULL)
     {
-	/*
-	 * The third-party imhangul module (and maybe others too) ignores
-	 * gtk_im_context_reset() or at least doesn't reset the active state.
-	 * Thus sending imactivatekey would turn it off if it was on before,
-	 * which is clearly not what we want.  Fortunately we can work around
-	 * that for imhangul by sending GDK_Escape, but I don't know if it
-	 * works with all IM modules that support an activation key :/
-	 *
-	 * An alternative approach would be to destroy the IM context and
-	 * recreate it.  But that means loading/unloading the IM module on
-	 * every mode switch, which causes a quite noticeable delay even on
-	 * my rather fast box...
-	 * *
-	 * Moreover, there are some XIM which cannot respond to
-	 * im_synthesize_keypress(). we hope that they reset by
-	 * xim_shutdown().
-	 */
-	if (im_activatekey_keyval != GDK_VoidSymbol && im_is_active)
-	    im_synthesize_keypress(GDK_Escape, 0U);
-
 	gtk_im_context_reset(xic);
 
-	/*
-	 * HACK for Ami: This sequence of function calls makes Ami handle
-	 * the IM reset graciously, without breaking loads of other stuff.
-	 * It seems to force English mode as well, which is exactly what we
-	 * want because it makes the Ami status display work reliably.
-	 */
-	gtk_im_context_set_use_preedit(xic, FALSE);
-
 	if (p_imdisable)
 	    im_shutdown();
 	else
 	{
-	    gtk_im_context_set_use_preedit(xic, TRUE);
 	    xim_set_focus(gui.in_focus);
 
-	    if (im_activatekey_keyval != GDK_VoidSymbol)
+	    if (p_imaf[0] != NUL)
+	    {
+		char_u *argv[1];
+
+		if (im_is_active)
+		    argv[0] = (char_u *)"1";
+		else
+		    argv[0] = (char_u *)"0";
+		(void)call_func_retnr(p_imaf, 1, argv, FALSE);
+	    }
+	    else if (im_activatekey_keyval != GDK_VoidSymbol)
 	    {
 		if (im_is_active)
 		{
@@ -5339,6 +5320,20 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
     int
 im_get_status(void)
 {
+    if (p_imsf[0] != NUL)
+    {
+	int is_active;
+
+	/* FIXME: Don't execute user function in unsafe situation. */
+	if (exiting || is_autocmd_blocked())
+	    return FALSE;
+	/* FIXME: :py print 'xxx' is shown duplicate result.
+	 * Use silent to avoid it. */
+	++msg_silent;
+	is_active = call_func_retnr(p_imsf, 0, NULL, FALSE);
+	--msg_silent;
+	return (is_active > 0);
+    }
     return im_is_active;
 }
 # endif
diff --git a/src/option.c b/src/option.c
index 63ba0f44f0..86aaebf4c4 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1458,6 +1458,15 @@ static struct vimoption
     {"ignorecase",  "ic",   P_BOOL|P_VI_DEF,
 			    (char_u *)&p_ic, PV_NONE,
 			    {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
+    {"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE,
+# if defined(FEAT_EVAL) && defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
+			    (char_u *)&p_imaf, PV_NONE,
+			    {(char_u *)"", (char_u *)NULL}
+# else
+			    (char_u *)NULL, PV_NONE,
+			    {(char_u *)NULL, (char_u *)0L}
+# endif
+			    SCRIPTID_INIT},
     {"imactivatekey","imak",P_STRING|P_VI_DEF,
 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
 			    (char_u *)&p_imak, PV_NONE,
@@ -1500,6 +1509,15 @@ static struct vimoption
 			    {(char_u *)B_IMODE_NONE, (char_u *)0L}
 #endif
 			    SCRIPTID_INIT},
+    {"imstatusfunc","imse",P_STRING|P_VI_DEF|P_SECURE,
+# if defined(FEAT_EVAL) && defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
+			    (char_u *)&p_imsf, PV_NONE,
+			    {(char_u *)"", (char_u *)NULL}
+# else
+			    (char_u *)NULL, PV_NONE,
+			    {(char_u *)NULL, (char_u *)0L}
+# endif
+			    SCRIPTID_INIT},
     {"include",	    "inc",  P_STRING|P_ALLOCED|P_VI_DEF,
 #ifdef FEAT_FIND_ID
 			    (char_u *)&p_inc, PV_INC,
diff --git a/src/option.h b/src/option.h
index cd178789fa..187e9f899c 100644
--- a/src/option.h
+++ b/src/option.h
@@ -570,6 +570,8 @@ EXTERN char_u	*p_iconstring;	/* 'iconstring' */
 EXTERN int	p_ic;		/* 'ignorecase' */
 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
 EXTERN char_u	*p_imak;	/* 'imactivatekey' */
+EXTERN char_u	*p_imaf;	/* 'imactivatefunc' */
+EXTERN char_u	*p_imsf;	/* 'imstatusfunc' */
 #endif
 #ifdef USE_IM_CONTROL
 EXTERN int	p_imcmdline;	/* 'imcmdline' */
diff --git a/src/po/README.txt b/src/po/README.txt
index 8962cb8eae..ae5b393932 100644
--- a/src/po/README.txt
+++ b/src/po/README.txt
@@ -65,8 +65,7 @@ language.
 	make xx
 
     This will extract all the strings from Vim and merge them in with the
-    existing translations.  Requires the GNU gettext utilities.  Also requires
-    unpacking the extra archive.
+    existing translations.  Requires the GNU gettext utilities.
     Your original xx.po file will be copied to xx.po.orig
 
     -- After you do this, you MUST do the next three steps! --
diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro
index 61eb712514..b24b958958 100644
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -49,6 +49,7 @@ int has_textchangedI __ARGS((void));
 int has_insertcharpre __ARGS((void));
 void block_autocmds __ARGS((void));
 void unblock_autocmds __ARGS((void));
+int is_autocmd_blocked __ARGS((void));
 char_u *getnextac __ARGS((int c, void *cookie, int indent));
 int has_autocmd __ARGS((event_T event, char_u *sfname, buf_T *buf));
 char_u *get_augroup_name __ARGS((expand_T *xp, int idx));
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index 01bc065b96..8146d9d61e 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -290,10 +290,11 @@ static void nfa_dump __ARGS((nfa_regprog_T *prog));
 #endif
 static int *re2post __ARGS((void));
 static nfa_state_T *alloc_state __ARGS((int c, nfa_state_T *out, nfa_state_T *out1));
+static void st_error __ARGS((int *postfix, int *end, int *p));
+static int nfa_max_width __ARGS((nfa_state_T *startstate, int depth));
 static nfa_state_T *post2nfa __ARGS((int *postfix, int *end, int nfa_calc_size));
 static void nfa_postprocess __ARGS((nfa_regprog_T *prog));
 static int check_char_class __ARGS((int class, int c));
-static void st_error __ARGS((int *postfix, int *end, int *p));
 static void nfa_save_listids __ARGS((nfa_regprog_T *prog, int *list));
 static void nfa_restore_listids __ARGS((nfa_regprog_T *prog, int *list));
 static int nfa_re_num_cmp __ARGS((long_u val, int op, long_u pos));
@@ -3469,6 +3470,7 @@ typedef struct
 #ifdef ENABLE_LOG
 static void log_subsexpr __ARGS((regsubs_T *subs));
 static void log_subexpr __ARGS((regsub_T *sub));
+static char *pim_info __ARGS((nfa_pim_T *pim));
 
     static void
 log_subsexpr(subs)
@@ -3508,7 +3510,8 @@ log_subexpr(sub)
 }
 
     static char *
-pim_info(nfa_pim_T *pim)
+pim_info(pim)
+    nfa_pim_T *pim;
 {
     static char buf[30];
 
@@ -3532,6 +3535,7 @@ static void clear_sub __ARGS((regsub_T *sub));
 static void copy_sub __ARGS((regsub_T *to, regsub_T *from));
 static void copy_sub_off __ARGS((regsub_T *to, regsub_T *from));
 static int sub_equal __ARGS((regsub_T *sub1, regsub_T *sub2));
+static int match_backref __ARGS((regsub_T *sub, int subidx, int *bytelen));
 static int has_state_with_pos __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs));
 static int state_in_list __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs));
 static void addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, nfa_pim_T *pim, int off));
@@ -3638,14 +3642,14 @@ sub_equal(sub1, sub2)
 	    if (i < sub1->in_use)
 		s1 = sub1->list.multi[i].start.lnum;
 	    else
-		s1 = 0;
+		s1 = -1;
 	    if (i < sub2->in_use)
 		s2 = sub2->list.multi[i].start.lnum;
 	    else
-		s2 = 0;
+		s2 = -1;
 	    if (s1 != s2)
 		return FALSE;
-	    if (s1 != 0 && sub1->list.multi[i].start.col
+	    if (s1 != -1 && sub1->list.multi[i].start.col
 					     != sub2->list.multi[i].start.col)
 		return FALSE;
 	}
@@ -3927,8 +3931,9 @@ addstate(l, state, subs, pim, off)
 	    if (state->lastlist[nfa_ll_index] == l->id)
 	    {
 		/* This state is already in the list, don't add it again,
-		 * unless it is an MOPEN that is used for a backreference. */
-		if (!nfa_has_backref)
+		 * unless it is an MOPEN that is used for a backreference or
+		 * when there is a PIM. */
+		if (!nfa_has_backref && pim == NULL)
 		{
 skip_add:
 #ifdef ENABLE_LOG
@@ -3945,9 +3950,9 @@ skip_add:
 		    goto skip_add;
 	    }
 
-	    /* When there are backreferences the number of states may be (a
-	     * lot) bigger than anticipated. */
-	    if (nfa_has_backref && l->n == l->len)
+	    /* When there are backreferences or PIMs the number of states may
+	     * be (a lot) bigger than anticipated. */
+	    if (l->n == l->len)
 	    {
 		int newlen = l->len * 3 / 2 + 50;
 
@@ -4319,8 +4324,6 @@ check_char_class(class, c)
     return FAIL;
 }
 
-static int match_backref __ARGS((regsub_T *sub, int subidx, int *bytelen));
-
 /*
  * Check for a match with subexpression "subidx".
  * Return TRUE if it matches.
@@ -5195,6 +5198,10 @@ nfa_regmatch(prog, start, submatch, m)
 			 || t->state->c == NFA_START_INVISIBLE_BEFORE_FIRST
 			 || t->state->c == NFA_START_INVISIBLE_BEFORE_NEG_FIRST)
 		    {
+			/* Copy submatch info for the recursive call, so that
+			 * \1 can be matched. */
+			copy_sub_off(&m->norm, &t->subs.norm);
+
 			/*
 			 * First try matching the invisible match, then what
 			 * follows.
diff --git a/src/testdir/pythonx/failing.py b/src/testdir/pythonx/failing.py
new file mode 100644
index 0000000000..30e73a0452
--- /dev/null
+++ b/src/testdir/pythonx/failing.py
@@ -0,0 +1 @@
+raise NotImplementedError
diff --git a/src/testdir/pythonx/failing_import.py b/src/testdir/pythonx/failing_import.py
new file mode 100644
index 0000000000..511cae7d71
--- /dev/null
+++ b/src/testdir/pythonx/failing_import.py
@@ -0,0 +1 @@
+raise ImportError
diff --git a/src/testdir/pythonx/topmodule/__init__.py b/src/testdir/pythonx/topmodule/__init__.py
new file mode 100644
index 0000000000..792d600548
--- /dev/null
+++ b/src/testdir/pythonx/topmodule/__init__.py
@@ -0,0 +1 @@
+#
diff --git a/src/testdir/pythonx/topmodule/submodule/__init__.py b/src/testdir/pythonx/topmodule/submodule/__init__.py
new file mode 100644
index 0000000000..792d600548
--- /dev/null
+++ b/src/testdir/pythonx/topmodule/submodule/__init__.py
@@ -0,0 +1 @@
+#
diff --git a/src/testdir/pythonx/topmodule/submodule/subsubmodule/__init__.py b/src/testdir/pythonx/topmodule/submodule/subsubmodule/__init__.py
new file mode 100644
index 0000000000..792d600548
--- /dev/null
+++ b/src/testdir/pythonx/topmodule/submodule/subsubmodule/__init__.py
@@ -0,0 +1 @@
+#
diff --git a/src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py b/src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py
new file mode 100644
index 0000000000..792d600548
--- /dev/null
+++ b/src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py
@@ -0,0 +1 @@
+#
diff --git a/src/testdir/test61.in b/src/testdir/test61.in
index 2602e97597..422adb897c 100644
--- a/src/testdir/test61.in
+++ b/src/testdir/test61.in
@@ -85,7 +85,7 @@ ggO---:0put b
 ggO---:0put a
 ggO---:w >>test.out
 :so small.vim
-:set nocp
+:set nocp viminfo+=nviminfo
 :enew!
 oa
 :set ul=100
diff --git a/src/testdir/test64.in b/src/testdir/test64.in
index 7c141797db..a7b5794d73 100644
--- a/src/testdir/test64.in
+++ b/src/testdir/test64.in
@@ -338,6 +338,7 @@ STARTTEST
 :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' bar foo '])
 :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo bar '])
 :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo xxx ', 'foo'])
+:call add(tl, [2, '[ ]\@!\p\%([ ]\@!\p\)*:', 'implicit mappings:', 'mappings:'])
 :"
 :"""" Combining different tests and features
 :call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
@@ -380,6 +381,9 @@ STARTTEST
 :call add(tl, [2, '\(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9', 'xabcddefghiabcddefghix', 'abcddefghiabcddefghi', 'a', 'b', 'c', 'dd', 'e', 'f', 'g', 'h', 'i'])
 :call add(tl, [2, '\(\d*\)a \1b', ' a b ', 'a b', ''])
 :call add(tl, [2, '^.\(.\).\_..\1.', "aaa\naaa\nb", "aaa\naaa", 'a'])
+:call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@ -1:
             msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
                               'TypeError:("\'NoneType\' object is not iterable",)')
+        if expr.find('FailingNumber') > -1:
+            msg = msg.replace(', not \'FailingNumber\'', '').replace('"', '\'')
+            msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
+                              'TypeError:("\'FailingNumber\' object is not iterable",)')
+        if msg.find('(\'\'') > -1 or msg.find('(\'can\'t') > -1:
+            msg = msg.replace('(\'', '("').replace('\',)', '",)')
         if expr == 'fd(self=[])':
             # HACK: PyMapping_Check changed meaning
             msg = msg.replace('AttributeError:(\'keys\',)',
-                              'TypeError:(\'unable to convert object to vim dictionary\',)')
+                              'TypeError:(\'unable to convert list to vim dictionary\',)')
         cb.append(expr + ':' + msg)
     else:
         cb.append(expr + ':NOT FAILED')
@@ -942,6 +949,7 @@ def convertfrompyobject_test(expr, recurse=True):
         '{u"": 1}',             # Same, but with unicode object
         'FailingMapping()',     #
         'FailingMappingKey()',  #
+        'FailingNumber()',      #
     ))
 
 def convertfrompymapping_test(expr):
@@ -956,66 +964,104 @@ def iter_test(expr):
         'FailingIterNext()',
     ))
 
+def number_test(expr, natural=False, unsigned=False):
+    if natural:
+        unsigned = True
+    return subexpr_test(expr, 'NumberToLong', (
+        '[]',
+        'None',
+    ) + (unsigned and ('-1',) or ())
+    + (natural and ('0',) or ()))
+
 class FailingTrue(object):
     def __nonzero__(self):
-        raise NotImplementedError
+        raise NotImplementedError('bool')
 
 class FailingIter(object):
     def __iter__(self):
-        raise NotImplementedError
+        raise NotImplementedError('iter')
 
 class FailingIterNext(object):
     def __iter__(self):
         return self
 
     def next(self):
-        raise NotImplementedError
+        raise NotImplementedError('next')
 
 class FailingMappingKey(object):
     def __getitem__(self, item):
-        raise NotImplementedError
+        raise NotImplementedError('getitem:mappingkey')
 
     def keys(self):
         return list("abcH")
 
 class FailingMapping(object):
     def __getitem__(self):
-        raise NotImplementedError
+        raise NotImplementedError('getitem:mapping')
 
     def keys(self):
-        raise NotImplementedError
+        raise NotImplementedError('keys')
 
 class FailingList(list):
     def __getitem__(self, idx):
         if i == 2:
-            raise NotImplementedError
+            raise NotImplementedError('getitem:list')
         else:
             return super(FailingList, self).__getitem__(idx)
 
+class NoArgsCall(object):
+    def __call__(self):
+        pass
+
+class FailingCall(object):
+    def __call__(self, path):
+        raise NotImplementedError('call')
+
+class FailingNumber(object):
+    def __int__(self):
+        raise NotImplementedError('int')
+
 cb.append("> Output")
 cb.append(">> OutputSetattr")
 ee('del sys.stdout.softspace')
-ee('sys.stdout.softspace = []')
+number_test('sys.stdout.softspace = %s', unsigned=True)
+number_test('sys.stderr.softspace = %s', unsigned=True)
 ee('sys.stdout.attr = None')
 cb.append(">> OutputWrite")
 ee('sys.stdout.write(None)')
 cb.append(">> OutputWriteLines")
 ee('sys.stdout.writelines(None)')
 ee('sys.stdout.writelines([1])')
-#iter_test('sys.stdout.writelines(%s)')
+iter_test('sys.stdout.writelines(%s)')
 cb.append("> VimCommand")
-ee('vim.command(1)')
+stringtochars_test('vim.command(%s)')
+ee('vim.command("", 2)')
 #! Not checked: vim->python exceptions translating: checked later
 cb.append("> VimToPython")
 #! Not checked: everything: needs errors in internal python functions
 cb.append("> VimEval")
-ee('vim.eval(1)')
+stringtochars_test('vim.eval(%s)')
+ee('vim.eval("", FailingTrue())')
 #! Not checked: everything: needs errors in internal python functions
 cb.append("> VimEvalPy")
-ee('vim.bindeval(1)')
+stringtochars_test('vim.bindeval(%s)')
+ee('vim.eval("", 2)')
 #! Not checked: vim->python exceptions translating: checked later
 cb.append("> VimStrwidth")
-ee('vim.strwidth(1)')
+stringtochars_test('vim.strwidth(%s)')
+cb.append("> VimForeachRTP")
+ee('vim.foreach_rtp(None)')
+ee('vim.foreach_rtp(NoArgsCall())')
+ee('vim.foreach_rtp(FailingCall())')
+ee('vim.foreach_rtp(int, 2)')
+cb.append('> import')
+old_rtp = vim.options['rtp']
+vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
+ee('import xxx_no_such_module_xxx')
+ee('import failing_import')
+ee('import failing')
+vim.options['rtp'] = old_rtp
+del old_rtp
 cb.append("> Dictionary")
 cb.append(">> DictionaryConstructor")
 ee('vim.Dictionary("abcI")')
@@ -1043,7 +1089,7 @@ cb.append(">>> kwargs")
 cb.append(">>> iter")
 ee('d.update(FailingMapping())')
 ee('d.update([FailingIterNext()])')
-#iter_test('d.update(%s)')
+iter_test('d.update(%s)')
 convertfrompyobject_test('d.update(%s)')
 stringtochars_test('d.update(((%s, 0),))')
 convertfrompyobject_test('d.update((("a", %s),))')
@@ -1055,7 +1101,7 @@ cb.append("> List")
 cb.append(">> ListConstructor")
 ee('vim.List(1, 2)')
 ee('vim.List(a=1)')
-#iter_test('vim.List(%s)')
+iter_test('vim.List(%s)')
 convertfrompyobject_test('vim.List([%s])')
 cb.append(">> ListItem")
 ee('l[1000]')
@@ -1064,10 +1110,10 @@ ee('ll[1] = 2')
 ee('l[1000] = 3')
 cb.append(">> ListAssSlice")
 ee('ll[1:100] = "abcJ"')
-#iter_test('l[:] = %s')
+iter_test('l[:] = %s')
 convertfrompyobject_test('l[:] = [%s]')
 cb.append(">> ListConcatInPlace")
-#iter_test('l.extend(%s)')
+iter_test('l.extend(%s)')
 convertfrompyobject_test('l.extend([%s])')
 cb.append(">> ListSetattr")
 ee('del l.locked')
@@ -1094,14 +1140,15 @@ cb.append(">> WindowSetattr")
 ee('vim.current.window.buffer = 0')
 ee('vim.current.window.cursor = (100000000, 100000000)')
 ee('vim.current.window.cursor = True')
-ee('vim.current.window.height = "abcK"')
-ee('vim.current.window.width  = "abcL"')
+number_test('vim.current.window.height = %s', unsigned=True)
+number_test('vim.current.window.width = %s', unsigned=True)
 ee('vim.current.window.xxxxxx = True')
 cb.append("> WinList")
 cb.append(">> WinListItem")
 ee('vim.windows[1000]')
 cb.append("> Buffer")
 cb.append(">> StringToLine (indirect)")
+ee('vim.current.buffer[0] = u"\\na"')
 ee('vim.current.buffer[0] = "\\na"')
 cb.append(">> SetBufferLine (indirect)")
 ee('vim.current.buffer[0] = True')
@@ -1129,8 +1176,8 @@ cb.append(">> BufferRange")
 ee('vim.current.buffer.range(1, 2, 3)')
 cb.append("> BufMap")
 cb.append(">> BufMapItem")
-ee('vim.buffers[None]')
 ee('vim.buffers[100000000]')
+number_test('vim.buffers[%s]', natural=True)
 cb.append("> Current")
 cb.append(">> CurrentGetattr")
 ee('vim.current.xxx')
@@ -1154,12 +1201,16 @@ del Mapping
 del convertfrompyobject_test
 del convertfrompymapping_test
 del iter_test
+del number_test
 del FailingTrue
 del FailingIter
 del FailingIterNext
 del FailingMapping
 del FailingMappingKey
 del FailingList
+del NoArgsCall
+del FailingCall
+del FailingNumber
 EOF
 :delfunction F
 :"
@@ -1168,6 +1219,16 @@ py << EOF
 sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
 sys.path.append(os.path.join(os.getcwd(), 'python_after'))
 vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
+l = []
+def callback(path):
+    l.append(path[-len('/testdir'):].replace(os.path.sep, '/'))
+vim.foreach_rtp(callback)
+cb.append(repr(l))
+del l
+def callback(path):
+    return path[-len('/testdir'):].replace(os.path.sep, '/')
+cb.append(repr(vim.foreach_rtp(callback)))
+del callback
 from module import dir as d
 from modulex import ddir
 cb.append(d + ',' + ddir)
@@ -1175,10 +1236,19 @@ import before
 cb.append(before.dir)
 import after
 cb.append(after.dir)
+import topmodule as tm
+import topmodule.submodule as tms
+import topmodule.submodule.subsubmodule.subsubsubmodule as tmsss
+cb.append(tm.__file__.replace('.pyc', '.py').replace(os.path.sep, '/')[-len('modulex/topmodule/__init__.py'):])
+cb.append(tms.__file__.replace('.pyc', '.py').replace(os.path.sep, '/')[-len('modulex/topmodule/submodule/__init__.py'):])
+cb.append(tmsss.__file__.replace('.pyc', '.py').replace(os.path.sep, '/')[-len('modulex/topmodule/submodule/subsubmodule/subsubsubmodule.py'):])
 del before
 del after
 del d
 del ddir
+del tm
+del tms
+del tmsss
 EOF
 :"
 :" Test exceptions
@@ -1232,6 +1302,7 @@ EOF
 :call garbagecollect(1)
 :"
 :/^start:/,$wq! test.out
+:" vim: et ts=4 isk-=\:
 :call getchar()
 ENDTEST
 
diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok
index b4abcc28c9..c8517b3dcd 100644
--- a/src/testdir/test86.ok
+++ b/src/testdir/test86.ok
@@ -441,28 +441,69 @@ test86.in
 > Output
 >> OutputSetattr
 del sys.stdout.softspace:AttributeError:("can't delete OutputObject attributes",)
+>>> Testing NumberToLong using sys.stdout.softspace = %s
 sys.stdout.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
+sys.stdout.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
+sys.stdout.softspace = -1:ValueError:('number must be greater or equal to zero',)
+<<< Finished
+>>> Testing NumberToLong using sys.stderr.softspace = %s
+sys.stderr.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
+sys.stderr.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
+sys.stderr.softspace = -1:ValueError:('number must be greater or equal to zero',)
+<<< Finished
 sys.stdout.attr = None:AttributeError:('invalid attribute: attr',)
 >> OutputWrite
 sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',)
 >> OutputWriteLines
 sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",)
 sys.stdout.writelines([1]):TypeError:('coercing to Unicode: need string or buffer, int found',)
+>>> Testing *Iter* using sys.stdout.writelines(%s)
+sys.stdout.writelines(FailingIter()):NotImplementedError:('iter',)
+sys.stdout.writelines(FailingIterNext()):NotImplementedError:('next',)
+<<< Finished
 > VimCommand
+>>> Testing StringToChars using vim.command(%s)
 vim.command(1):TypeError:('expected str() or unicode() instance, but got int',)
+vim.command(u"\0"):TypeError:('expected string without null bytes',)
+vim.command("\0"):TypeError:('expected string without null bytes',)
+<<< Finished
+vim.command("", 2):TypeError:('command() takes exactly one argument (2 given)',)
 > VimToPython
 > VimEval
+>>> Testing StringToChars using vim.eval(%s)
 vim.eval(1):TypeError:('expected str() or unicode() instance, but got int',)
+vim.eval(u"\0"):TypeError:('expected string without null bytes',)
+vim.eval("\0"):TypeError:('expected string without null bytes',)
+<<< Finished
+vim.eval("", FailingTrue()):TypeError:('function takes exactly 1 argument (2 given)',)
 > VimEvalPy
+>>> Testing StringToChars using vim.bindeval(%s)
 vim.bindeval(1):TypeError:('expected str() or unicode() instance, but got int',)
+vim.bindeval(u"\0"):TypeError:('expected string without null bytes',)
+vim.bindeval("\0"):TypeError:('expected string without null bytes',)
+<<< Finished
+vim.eval("", 2):TypeError:('function takes exactly 1 argument (2 given)',)
 > VimStrwidth
+>>> Testing StringToChars using vim.strwidth(%s)
 vim.strwidth(1):TypeError:('expected str() or unicode() instance, but got int',)
+vim.strwidth(u"\0"):TypeError:('expected string without null bytes',)
+vim.strwidth("\0"):TypeError:('expected string without null bytes',)
+<<< Finished
+> VimForeachRTP
+vim.foreach_rtp(None):TypeError:("'NoneType' object is not callable",)
+vim.foreach_rtp(NoArgsCall()):TypeError:('__call__() takes exactly 1 argument (2 given)',)
+vim.foreach_rtp(FailingCall()):NotImplementedError:('call',)
+vim.foreach_rtp(int, 2):TypeError:('foreach_rtp() takes exactly one argument (2 given)',)
+> import
+import xxx_no_such_module_xxx:ImportError:('No module named xxx_no_such_module_xxx',)
+import failing_import:ImportError:('No module named failing_import',)
+import failing:NotImplementedError:()
 > Dictionary
 >> DictionaryConstructor
 vim.Dictionary("abcI"):ValueError:('expected sequence element of size 2, but got sequence of size 1',)
 >> DictionarySetattr
 del d.locked:AttributeError:('cannot delete vim.Dictionary attributes',)
-d.locked = FailingTrue():NotImplementedError:()
+d.locked = FailingTrue():NotImplementedError:('bool',)
 vim.vvars.locked = False:TypeError:('cannot modify fixed dictionary',)
 d.scope = True:AttributeError:('cannot set attribute scope',)
 d.xxx = True:AttributeError:('cannot set attribute xxx',)
@@ -501,14 +542,15 @@ d["a"] = {"abcF" : Mapping({"\0" : 1})}:TypeError:('expected string without null
 <<< Finished
 >>> Testing *Iter* using d["a"] = {"abcF" : %s}
 d["a"] = {"abcF" : FailingIter()}:TypeError:('unable to convert FailingIter to vim structure',)
-d["a"] = {"abcF" : FailingIterNext()}:NotImplementedError:()
+d["a"] = {"abcF" : FailingIterNext()}:NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using d["a"] = {"abcF" : %s}
 d["a"] = {"abcF" : None}:TypeError:('unable to convert NoneType to vim structure',)
 d["a"] = {"abcF" : {"": 1}}:ValueError:('empty keys are not allowed',)
 d["a"] = {"abcF" : {u"": 1}}:ValueError:('empty keys are not allowed',)
-d["a"] = {"abcF" : FailingMapping()}:NotImplementedError:()
-d["a"] = {"abcF" : FailingMappingKey()}:NotImplementedError:()
+d["a"] = {"abcF" : FailingMapping()}:NotImplementedError:('keys',)
+d["a"] = {"abcF" : FailingMappingKey()}:NotImplementedError:('getitem:mappingkey',)
+d["a"] = {"abcF" : FailingNumber()}:TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing StringToChars using d["a"] = Mapping({%s : 1})
 d["a"] = Mapping({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',)
@@ -527,31 +569,37 @@ d["a"] = Mapping({"abcG" : Mapping({"\0" : 1})}):TypeError:('expected string wit
 <<< Finished
 >>> Testing *Iter* using d["a"] = Mapping({"abcG" : %s})
 d["a"] = Mapping({"abcG" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',)
-d["a"] = Mapping({"abcG" : FailingIterNext()}):NotImplementedError:()
+d["a"] = Mapping({"abcG" : FailingIterNext()}):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using d["a"] = Mapping({"abcG" : %s})
 d["a"] = Mapping({"abcG" : None}):TypeError:('unable to convert NoneType to vim structure',)
 d["a"] = Mapping({"abcG" : {"": 1}}):ValueError:('empty keys are not allowed',)
 d["a"] = Mapping({"abcG" : {u"": 1}}):ValueError:('empty keys are not allowed',)
-d["a"] = Mapping({"abcG" : FailingMapping()}):NotImplementedError:()
-d["a"] = Mapping({"abcG" : FailingMappingKey()}):NotImplementedError:()
+d["a"] = Mapping({"abcG" : FailingMapping()}):NotImplementedError:('keys',)
+d["a"] = Mapping({"abcG" : FailingMappingKey()}):NotImplementedError:('getitem:mappingkey',)
+d["a"] = Mapping({"abcG" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing *Iter* using d["a"] = %s
 d["a"] = FailingIter():TypeError:('unable to convert FailingIter to vim structure',)
-d["a"] = FailingIterNext():NotImplementedError:()
+d["a"] = FailingIterNext():NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using d["a"] = %s
 d["a"] = None:TypeError:('unable to convert NoneType to vim structure',)
 d["a"] = {"": 1}:ValueError:('empty keys are not allowed',)
 d["a"] = {u"": 1}:ValueError:('empty keys are not allowed',)
-d["a"] = FailingMapping():NotImplementedError:()
-d["a"] = FailingMappingKey():NotImplementedError:()
+d["a"] = FailingMapping():NotImplementedError:('keys',)
+d["a"] = FailingMappingKey():NotImplementedError:('getitem:mappingkey',)
+d["a"] = FailingNumber():TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >> DictionaryUpdate
 >>> kwargs
 >>> iter
-d.update(FailingMapping()):NotImplementedError:()
-d.update([FailingIterNext()]):NotImplementedError:()
+d.update(FailingMapping()):NotImplementedError:('keys',)
+d.update([FailingIterNext()]):NotImplementedError:('next',)
+>>> Testing *Iter* using d.update(%s)
+d.update(FailingIter()):NotImplementedError:('iter',)
+d.update(FailingIterNext()):NotImplementedError:('next',)
+<<< Finished
 >>> Testing StringToChars using d.update({%s : 1})
 d.update({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',)
 d.update({u"\0" : 1}):TypeError:('expected string without null bytes',)
@@ -569,14 +617,15 @@ d.update({"abcF" : Mapping({"\0" : 1})}):TypeError:('expected string without nul
 <<< Finished
 >>> Testing *Iter* using d.update({"abcF" : %s})
 d.update({"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',)
-d.update({"abcF" : FailingIterNext()}):NotImplementedError:()
+d.update({"abcF" : FailingIterNext()}):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update({"abcF" : %s})
 d.update({"abcF" : None}):TypeError:('unable to convert NoneType to vim structure',)
 d.update({"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',)
 d.update({"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',)
-d.update({"abcF" : FailingMapping()}):NotImplementedError:()
-d.update({"abcF" : FailingMappingKey()}):NotImplementedError:()
+d.update({"abcF" : FailingMapping()}):NotImplementedError:('keys',)
+d.update({"abcF" : FailingMappingKey()}):NotImplementedError:('getitem:mappingkey',)
+d.update({"abcF" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing StringToChars using d.update(Mapping({%s : 1}))
 d.update(Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',)
@@ -595,25 +644,27 @@ d.update(Mapping({"abcG" : Mapping({"\0" : 1})})):TypeError:('expected string wi
 <<< Finished
 >>> Testing *Iter* using d.update(Mapping({"abcG" : %s}))
 d.update(Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',)
-d.update(Mapping({"abcG" : FailingIterNext()})):NotImplementedError:()
+d.update(Mapping({"abcG" : FailingIterNext()})):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update(Mapping({"abcG" : %s}))
 d.update(Mapping({"abcG" : None})):TypeError:('unable to convert NoneType to vim structure',)
 d.update(Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',)
 d.update(Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',)
-d.update(Mapping({"abcG" : FailingMapping()})):NotImplementedError:()
-d.update(Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:()
+d.update(Mapping({"abcG" : FailingMapping()})):NotImplementedError:('keys',)
+d.update(Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:('getitem:mappingkey',)
+d.update(Mapping({"abcG" : FailingNumber()})):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing *Iter* using d.update(%s)
-d.update(FailingIter()):NotImplementedError:()
-d.update(FailingIterNext()):NotImplementedError:()
+d.update(FailingIter()):NotImplementedError:('iter',)
+d.update(FailingIterNext()):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update(%s)
 d.update(None):TypeError:("'NoneType' object is not iterable",)
 d.update({"": 1}):ValueError:('empty keys are not allowed',)
 d.update({u"": 1}):ValueError:('empty keys are not allowed',)
-d.update(FailingMapping()):NotImplementedError:()
-d.update(FailingMappingKey()):NotImplementedError:()
+d.update(FailingMapping()):NotImplementedError:('keys',)
+d.update(FailingMappingKey()):NotImplementedError:('getitem:mappingkey',)
+d.update(FailingNumber()):TypeError:("'FailingNumber' object is not iterable",)
 <<< Finished
 >>> Testing StringToChars using d.update(((%s, 0),))
 d.update(((1, 0),)):TypeError:('expected str() or unicode() instance, but got int',)
@@ -637,14 +688,15 @@ d.update((("a", {"abcF" : Mapping({"\0" : 1})}),)):TypeError:('expected string w
 <<< Finished
 >>> Testing *Iter* using d.update((("a", {"abcF" : %s}),))
 d.update((("a", {"abcF" : FailingIter()}),)):TypeError:('unable to convert FailingIter to vim structure',)
-d.update((("a", {"abcF" : FailingIterNext()}),)):NotImplementedError:()
+d.update((("a", {"abcF" : FailingIterNext()}),)):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update((("a", {"abcF" : %s}),))
 d.update((("a", {"abcF" : None}),)):TypeError:('unable to convert NoneType to vim structure',)
 d.update((("a", {"abcF" : {"": 1}}),)):ValueError:('empty keys are not allowed',)
 d.update((("a", {"abcF" : {u"": 1}}),)):ValueError:('empty keys are not allowed',)
-d.update((("a", {"abcF" : FailingMapping()}),)):NotImplementedError:()
-d.update((("a", {"abcF" : FailingMappingKey()}),)):NotImplementedError:()
+d.update((("a", {"abcF" : FailingMapping()}),)):NotImplementedError:('keys',)
+d.update((("a", {"abcF" : FailingMappingKey()}),)):NotImplementedError:('getitem:mappingkey',)
+d.update((("a", {"abcF" : FailingNumber()}),)):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),))
 d.update((("a", Mapping({1 : 1})),)):TypeError:('expected str() or unicode() instance, but got int',)
@@ -663,25 +715,27 @@ d.update((("a", Mapping({"abcG" : Mapping({"\0" : 1})})),)):TypeError:('expected
 <<< Finished
 >>> Testing *Iter* using d.update((("a", Mapping({"abcG" : %s})),))
 d.update((("a", Mapping({"abcG" : FailingIter()})),)):TypeError:('unable to convert FailingIter to vim structure',)
-d.update((("a", Mapping({"abcG" : FailingIterNext()})),)):NotImplementedError:()
+d.update((("a", Mapping({"abcG" : FailingIterNext()})),)):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abcG" : %s})),))
 d.update((("a", Mapping({"abcG" : None})),)):TypeError:('unable to convert NoneType to vim structure',)
 d.update((("a", Mapping({"abcG" : {"": 1}})),)):ValueError:('empty keys are not allowed',)
 d.update((("a", Mapping({"abcG" : {u"": 1}})),)):ValueError:('empty keys are not allowed',)
-d.update((("a", Mapping({"abcG" : FailingMapping()})),)):NotImplementedError:()
-d.update((("a", Mapping({"abcG" : FailingMappingKey()})),)):NotImplementedError:()
+d.update((("a", Mapping({"abcG" : FailingMapping()})),)):NotImplementedError:('keys',)
+d.update((("a", Mapping({"abcG" : FailingMappingKey()})),)):NotImplementedError:('getitem:mappingkey',)
+d.update((("a", Mapping({"abcG" : FailingNumber()})),)):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing *Iter* using d.update((("a", %s),))
 d.update((("a", FailingIter()),)):TypeError:('unable to convert FailingIter to vim structure',)
-d.update((("a", FailingIterNext()),)):NotImplementedError:()
+d.update((("a", FailingIterNext()),)):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update((("a", %s),))
 d.update((("a", None),)):TypeError:('unable to convert NoneType to vim structure',)
 d.update((("a", {"": 1}),)):ValueError:('empty keys are not allowed',)
 d.update((("a", {u"": 1}),)):ValueError:('empty keys are not allowed',)
-d.update((("a", FailingMapping()),)):NotImplementedError:()
-d.update((("a", FailingMappingKey()),)):NotImplementedError:()
+d.update((("a", FailingMapping()),)):NotImplementedError:('keys',)
+d.update((("a", FailingMappingKey()),)):NotImplementedError:('getitem:mappingkey',)
+d.update((("a", FailingNumber()),)):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >> DictionaryPopItem
 d.popitem(1, 2):TypeError:('popitem() takes no arguments (2 given)',)
@@ -691,6 +745,10 @@ d.has_key():TypeError:('has_key() takes exactly one argument (0 given)',)
 >> ListConstructor
 vim.List(1, 2):TypeError:('function takes at most 1 argument (2 given)',)
 vim.List(a=1):TypeError:('list constructor does not accept keyword arguments',)
+>>> Testing *Iter* using vim.List(%s)
+vim.List(FailingIter()):NotImplementedError:('iter',)
+vim.List(FailingIterNext()):NotImplementedError:('next',)
+<<< Finished
 >>> Testing StringToChars using vim.List([{%s : 1}])
 vim.List([{1 : 1}]):TypeError:('expected str() or unicode() instance, but got int',)
 vim.List([{u"\0" : 1}]):TypeError:('expected string without null bytes',)
@@ -708,14 +766,15 @@ vim.List([{"abcF" : Mapping({"\0" : 1})}]):TypeError:('expected string without n
 <<< Finished
 >>> Testing *Iter* using vim.List([{"abcF" : %s}])
 vim.List([{"abcF" : FailingIter()}]):TypeError:('unable to convert FailingIter to vim structure',)
-vim.List([{"abcF" : FailingIterNext()}]):NotImplementedError:()
+vim.List([{"abcF" : FailingIterNext()}]):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using vim.List([{"abcF" : %s}])
 vim.List([{"abcF" : None}]):TypeError:('unable to convert NoneType to vim structure',)
 vim.List([{"abcF" : {"": 1}}]):ValueError:('empty keys are not allowed',)
 vim.List([{"abcF" : {u"": 1}}]):ValueError:('empty keys are not allowed',)
-vim.List([{"abcF" : FailingMapping()}]):NotImplementedError:()
-vim.List([{"abcF" : FailingMappingKey()}]):NotImplementedError:()
+vim.List([{"abcF" : FailingMapping()}]):NotImplementedError:('keys',)
+vim.List([{"abcF" : FailingMappingKey()}]):NotImplementedError:('getitem:mappingkey',)
+vim.List([{"abcF" : FailingNumber()}]):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing StringToChars using vim.List([Mapping({%s : 1})])
 vim.List([Mapping({1 : 1})]):TypeError:('expected str() or unicode() instance, but got int',)
@@ -734,25 +793,27 @@ vim.List([Mapping({"abcG" : Mapping({"\0" : 1})})]):TypeError:('expected string
 <<< Finished
 >>> Testing *Iter* using vim.List([Mapping({"abcG" : %s})])
 vim.List([Mapping({"abcG" : FailingIter()})]):TypeError:('unable to convert FailingIter to vim structure',)
-vim.List([Mapping({"abcG" : FailingIterNext()})]):NotImplementedError:()
+vim.List([Mapping({"abcG" : FailingIterNext()})]):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using vim.List([Mapping({"abcG" : %s})])
 vim.List([Mapping({"abcG" : None})]):TypeError:('unable to convert NoneType to vim structure',)
 vim.List([Mapping({"abcG" : {"": 1}})]):ValueError:('empty keys are not allowed',)
 vim.List([Mapping({"abcG" : {u"": 1}})]):ValueError:('empty keys are not allowed',)
-vim.List([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:()
-vim.List([Mapping({"abcG" : FailingMappingKey()})]):NotImplementedError:()
+vim.List([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:('keys',)
+vim.List([Mapping({"abcG" : FailingMappingKey()})]):NotImplementedError:('getitem:mappingkey',)
+vim.List([Mapping({"abcG" : FailingNumber()})]):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing *Iter* using vim.List([%s])
 vim.List([FailingIter()]):TypeError:('unable to convert FailingIter to vim structure',)
-vim.List([FailingIterNext()]):NotImplementedError:()
+vim.List([FailingIterNext()]):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using vim.List([%s])
 vim.List([None]):TypeError:('unable to convert NoneType to vim structure',)
 vim.List([{"": 1}]):ValueError:('empty keys are not allowed',)
 vim.List([{u"": 1}]):ValueError:('empty keys are not allowed',)
-vim.List([FailingMapping()]):NotImplementedError:()
-vim.List([FailingMappingKey()]):NotImplementedError:()
+vim.List([FailingMapping()]):NotImplementedError:('keys',)
+vim.List([FailingMappingKey()]):NotImplementedError:('getitem:mappingkey',)
+vim.List([FailingNumber()]):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >> ListItem
 l[1000]:IndexError:('list index out of range',)
@@ -761,6 +822,10 @@ ll[1] = 2:error:('list is locked',)
 l[1000] = 3:IndexError:('list index out of range',)
 >> ListAssSlice
 ll[1:100] = "abcJ":error:('list is locked',)
+>>> Testing *Iter* using l[:] = %s
+l[:] = FailingIter():NotImplementedError:('iter',)
+l[:] = FailingIterNext():NotImplementedError:('next',)
+<<< Finished
 >>> Testing StringToChars using l[:] = [{%s : 1}]
 l[:] = [{1 : 1}]:TypeError:('expected str() or unicode() instance, but got int',)
 l[:] = [{u"\0" : 1}]:TypeError:('expected string without null bytes',)
@@ -778,14 +843,15 @@ l[:] = [{"abcF" : Mapping({"\0" : 1})}]:TypeError:('expected string without null
 <<< Finished
 >>> Testing *Iter* using l[:] = [{"abcF" : %s}]
 l[:] = [{"abcF" : FailingIter()}]:TypeError:('unable to convert FailingIter to vim structure',)
-l[:] = [{"abcF" : FailingIterNext()}]:NotImplementedError:()
+l[:] = [{"abcF" : FailingIterNext()}]:NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using l[:] = [{"abcF" : %s}]
 l[:] = [{"abcF" : None}]:TypeError:('unable to convert NoneType to vim structure',)
 l[:] = [{"abcF" : {"": 1}}]:ValueError:('empty keys are not allowed',)
 l[:] = [{"abcF" : {u"": 1}}]:ValueError:('empty keys are not allowed',)
-l[:] = [{"abcF" : FailingMapping()}]:NotImplementedError:()
-l[:] = [{"abcF" : FailingMappingKey()}]:NotImplementedError:()
+l[:] = [{"abcF" : FailingMapping()}]:NotImplementedError:('keys',)
+l[:] = [{"abcF" : FailingMappingKey()}]:NotImplementedError:('getitem:mappingkey',)
+l[:] = [{"abcF" : FailingNumber()}]:TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing StringToChars using l[:] = [Mapping({%s : 1})]
 l[:] = [Mapping({1 : 1})]:TypeError:('expected str() or unicode() instance, but got int',)
@@ -804,27 +870,33 @@ l[:] = [Mapping({"abcG" : Mapping({"\0" : 1})})]:TypeError:('expected string wit
 <<< Finished
 >>> Testing *Iter* using l[:] = [Mapping({"abcG" : %s})]
 l[:] = [Mapping({"abcG" : FailingIter()})]:TypeError:('unable to convert FailingIter to vim structure',)
-l[:] = [Mapping({"abcG" : FailingIterNext()})]:NotImplementedError:()
+l[:] = [Mapping({"abcG" : FailingIterNext()})]:NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using l[:] = [Mapping({"abcG" : %s})]
 l[:] = [Mapping({"abcG" : None})]:TypeError:('unable to convert NoneType to vim structure',)
 l[:] = [Mapping({"abcG" : {"": 1}})]:ValueError:('empty keys are not allowed',)
 l[:] = [Mapping({"abcG" : {u"": 1}})]:ValueError:('empty keys are not allowed',)
-l[:] = [Mapping({"abcG" : FailingMapping()})]:NotImplementedError:()
-l[:] = [Mapping({"abcG" : FailingMappingKey()})]:NotImplementedError:()
+l[:] = [Mapping({"abcG" : FailingMapping()})]:NotImplementedError:('keys',)
+l[:] = [Mapping({"abcG" : FailingMappingKey()})]:NotImplementedError:('getitem:mappingkey',)
+l[:] = [Mapping({"abcG" : FailingNumber()})]:TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing *Iter* using l[:] = [%s]
 l[:] = [FailingIter()]:TypeError:('unable to convert FailingIter to vim structure',)
-l[:] = [FailingIterNext()]:NotImplementedError:()
+l[:] = [FailingIterNext()]:NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using l[:] = [%s]
 l[:] = [None]:TypeError:('unable to convert NoneType to vim structure',)
 l[:] = [{"": 1}]:ValueError:('empty keys are not allowed',)
 l[:] = [{u"": 1}]:ValueError:('empty keys are not allowed',)
-l[:] = [FailingMapping()]:NotImplementedError:()
-l[:] = [FailingMappingKey()]:NotImplementedError:()
+l[:] = [FailingMapping()]:NotImplementedError:('keys',)
+l[:] = [FailingMappingKey()]:NotImplementedError:('getitem:mappingkey',)
+l[:] = [FailingNumber()]:TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >> ListConcatInPlace
+>>> Testing *Iter* using l.extend(%s)
+l.extend(FailingIter()):NotImplementedError:('iter',)
+l.extend(FailingIterNext()):NotImplementedError:('next',)
+<<< Finished
 >>> Testing StringToChars using l.extend([{%s : 1}])
 l.extend([{1 : 1}]):TypeError:('expected str() or unicode() instance, but got int',)
 l.extend([{u"\0" : 1}]):TypeError:('expected string without null bytes',)
@@ -842,14 +914,15 @@ l.extend([{"abcF" : Mapping({"\0" : 1})}]):TypeError:('expected string without n
 <<< Finished
 >>> Testing *Iter* using l.extend([{"abcF" : %s}])
 l.extend([{"abcF" : FailingIter()}]):TypeError:('unable to convert FailingIter to vim structure',)
-l.extend([{"abcF" : FailingIterNext()}]):NotImplementedError:()
+l.extend([{"abcF" : FailingIterNext()}]):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using l.extend([{"abcF" : %s}])
 l.extend([{"abcF" : None}]):TypeError:('unable to convert NoneType to vim structure',)
 l.extend([{"abcF" : {"": 1}}]):ValueError:('empty keys are not allowed',)
 l.extend([{"abcF" : {u"": 1}}]):ValueError:('empty keys are not allowed',)
-l.extend([{"abcF" : FailingMapping()}]):NotImplementedError:()
-l.extend([{"abcF" : FailingMappingKey()}]):NotImplementedError:()
+l.extend([{"abcF" : FailingMapping()}]):NotImplementedError:('keys',)
+l.extend([{"abcF" : FailingMappingKey()}]):NotImplementedError:('getitem:mappingkey',)
+l.extend([{"abcF" : FailingNumber()}]):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing StringToChars using l.extend([Mapping({%s : 1})])
 l.extend([Mapping({1 : 1})]):TypeError:('expected str() or unicode() instance, but got int',)
@@ -868,29 +941,31 @@ l.extend([Mapping({"abcG" : Mapping({"\0" : 1})})]):TypeError:('expected string
 <<< Finished
 >>> Testing *Iter* using l.extend([Mapping({"abcG" : %s})])
 l.extend([Mapping({"abcG" : FailingIter()})]):TypeError:('unable to convert FailingIter to vim structure',)
-l.extend([Mapping({"abcG" : FailingIterNext()})]):NotImplementedError:()
+l.extend([Mapping({"abcG" : FailingIterNext()})]):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using l.extend([Mapping({"abcG" : %s})])
 l.extend([Mapping({"abcG" : None})]):TypeError:('unable to convert NoneType to vim structure',)
 l.extend([Mapping({"abcG" : {"": 1}})]):ValueError:('empty keys are not allowed',)
 l.extend([Mapping({"abcG" : {u"": 1}})]):ValueError:('empty keys are not allowed',)
-l.extend([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:()
-l.extend([Mapping({"abcG" : FailingMappingKey()})]):NotImplementedError:()
+l.extend([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:('keys',)
+l.extend([Mapping({"abcG" : FailingMappingKey()})]):NotImplementedError:('getitem:mappingkey',)
+l.extend([Mapping({"abcG" : FailingNumber()})]):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing *Iter* using l.extend([%s])
 l.extend([FailingIter()]):TypeError:('unable to convert FailingIter to vim structure',)
-l.extend([FailingIterNext()]):NotImplementedError:()
+l.extend([FailingIterNext()]):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using l.extend([%s])
 l.extend([None]):TypeError:('unable to convert NoneType to vim structure',)
 l.extend([{"": 1}]):ValueError:('empty keys are not allowed',)
 l.extend([{u"": 1}]):ValueError:('empty keys are not allowed',)
-l.extend([FailingMapping()]):NotImplementedError:()
-l.extend([FailingMappingKey()]):NotImplementedError:()
+l.extend([FailingMapping()]):NotImplementedError:('keys',)
+l.extend([FailingMappingKey()]):NotImplementedError:('getitem:mappingkey',)
+l.extend([FailingNumber()]):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >> ListSetattr
 del l.locked:AttributeError:('cannot delete vim.List attributes',)
-l.locked = FailingTrue():NotImplementedError:()
+l.locked = FailingTrue():NotImplementedError:('bool',)
 l.xxx = True:AttributeError:('cannot set attribute xxx',)
 > Function
 >> FunctionConstructor
@@ -915,14 +990,15 @@ f({"abcF" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes
 <<< Finished
 >>> Testing *Iter* using f({"abcF" : %s})
 f({"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',)
-f({"abcF" : FailingIterNext()}):NotImplementedError:()
+f({"abcF" : FailingIterNext()}):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using f({"abcF" : %s})
 f({"abcF" : None}):TypeError:('unable to convert NoneType to vim structure',)
 f({"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',)
 f({"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',)
-f({"abcF" : FailingMapping()}):NotImplementedError:()
-f({"abcF" : FailingMappingKey()}):NotImplementedError:()
+f({"abcF" : FailingMapping()}):NotImplementedError:('keys',)
+f({"abcF" : FailingMappingKey()}):NotImplementedError:('getitem:mappingkey',)
+f({"abcF" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing StringToChars using f(Mapping({%s : 1}))
 f(Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',)
@@ -941,25 +1017,27 @@ f(Mapping({"abcG" : Mapping({"\0" : 1})})):TypeError:('expected string without n
 <<< Finished
 >>> Testing *Iter* using f(Mapping({"abcG" : %s}))
 f(Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',)
-f(Mapping({"abcG" : FailingIterNext()})):NotImplementedError:()
+f(Mapping({"abcG" : FailingIterNext()})):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using f(Mapping({"abcG" : %s}))
 f(Mapping({"abcG" : None})):TypeError:('unable to convert NoneType to vim structure',)
 f(Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',)
 f(Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',)
-f(Mapping({"abcG" : FailingMapping()})):NotImplementedError:()
-f(Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:()
+f(Mapping({"abcG" : FailingMapping()})):NotImplementedError:('keys',)
+f(Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:('getitem:mappingkey',)
+f(Mapping({"abcG" : FailingNumber()})):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing *Iter* using f(%s)
 f(FailingIter()):TypeError:('unable to convert FailingIter to vim structure',)
-f(FailingIterNext()):NotImplementedError:()
+f(FailingIterNext()):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using f(%s)
 f(None):TypeError:('unable to convert NoneType to vim structure',)
 f({"": 1}):ValueError:('empty keys are not allowed',)
 f({u"": 1}):ValueError:('empty keys are not allowed',)
-f(FailingMapping()):NotImplementedError:()
-f(FailingMappingKey()):NotImplementedError:()
+f(FailingMapping()):NotImplementedError:('keys',)
+f(FailingMappingKey()):NotImplementedError:('getitem:mappingkey',)
+f(FailingNumber()):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing StringToChars using fd(self={%s : 1})
 fd(self={1 : 1}):TypeError:('expected str() or unicode() instance, but got int',)
@@ -978,14 +1056,15 @@ fd(self={"abcF" : Mapping({"\0" : 1})}):TypeError:('expected string without null
 <<< Finished
 >>> Testing *Iter* using fd(self={"abcF" : %s})
 fd(self={"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',)
-fd(self={"abcF" : FailingIterNext()}):NotImplementedError:()
+fd(self={"abcF" : FailingIterNext()}):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using fd(self={"abcF" : %s})
 fd(self={"abcF" : None}):TypeError:('unable to convert NoneType to vim structure',)
 fd(self={"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',)
 fd(self={"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',)
-fd(self={"abcF" : FailingMapping()}):NotImplementedError:()
-fd(self={"abcF" : FailingMappingKey()}):NotImplementedError:()
+fd(self={"abcF" : FailingMapping()}):NotImplementedError:('keys',)
+fd(self={"abcF" : FailingMappingKey()}):NotImplementedError:('getitem:mappingkey',)
+fd(self={"abcF" : FailingNumber()}):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing StringToChars using fd(self=Mapping({%s : 1}))
 fd(self=Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',)
@@ -1004,14 +1083,15 @@ fd(self=Mapping({"abcG" : Mapping({"\0" : 1})})):TypeError:('expected string wit
 <<< Finished
 >>> Testing *Iter* using fd(self=Mapping({"abcG" : %s}))
 fd(self=Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',)
-fd(self=Mapping({"abcG" : FailingIterNext()})):NotImplementedError:()
+fd(self=Mapping({"abcG" : FailingIterNext()})):NotImplementedError:('next',)
 <<< Finished
 >>> Testing ConvertFromPyObject using fd(self=Mapping({"abcG" : %s}))
 fd(self=Mapping({"abcG" : None})):TypeError:('unable to convert NoneType to vim structure',)
 fd(self=Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',)
 fd(self=Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',)
-fd(self=Mapping({"abcG" : FailingMapping()})):NotImplementedError:()
-fd(self=Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:()
+fd(self=Mapping({"abcG" : FailingMapping()})):NotImplementedError:('keys',)
+fd(self=Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:('getitem:mappingkey',)
+fd(self=Mapping({"abcG" : FailingNumber()})):TypeError:('long() argument must be a string or a number',)
 <<< Finished
 >>> Testing *Iter* using fd(self=%s)
 fd(self=FailingIter()):TypeError:('unable to convert FailingIter to vim dictionary',)
@@ -1021,8 +1101,9 @@ fd(self=FailingIterNext()):TypeError:('unable to convert FailingIterNext to vim
 fd(self=None):TypeError:('unable to convert NoneType to vim dictionary',)
 fd(self={"": 1}):ValueError:('empty keys are not allowed',)
 fd(self={u"": 1}):ValueError:('empty keys are not allowed',)
-fd(self=FailingMapping()):NotImplementedError:()
-fd(self=FailingMappingKey()):NotImplementedError:()
+fd(self=FailingMapping()):NotImplementedError:('keys',)
+fd(self=FailingMappingKey()):NotImplementedError:('getitem:mappingkey',)
+fd(self=FailingNumber()):TypeError:('unable to convert FailingNumber to vim dictionary',)
 <<< Finished
 >>> Testing ConvertFromPyMapping using fd(self=%s)
 fd(self=[]):TypeError:('unable to convert list to vim dictionary',)
@@ -1040,14 +1121,23 @@ vim.current.window.xxx:AttributeError:('xxx',)
 vim.current.window.buffer = 0:TypeError:('readonly attribute: buffer',)
 vim.current.window.cursor = (100000000, 100000000):error:('cursor position outside buffer',)
 vim.current.window.cursor = True:TypeError:('argument must be 2-item sequence, not bool',)
-vim.current.window.height = "abcK":TypeError:('expected int(), long() or something supporting coercing to long(), but got str',)
-vim.current.window.width  = "abcL":TypeError:('expected int(), long() or something supporting coercing to long(), but got str',)
+>>> Testing NumberToLong using vim.current.window.height = %s
+vim.current.window.height = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
+vim.current.window.height = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
+vim.current.window.height = -1:ValueError:('number must be greater or equal to zero',)
+<<< Finished
+>>> Testing NumberToLong using vim.current.window.width = %s
+vim.current.window.width = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
+vim.current.window.width = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
+vim.current.window.width = -1:ValueError:('number must be greater or equal to zero',)
+<<< Finished
 vim.current.window.xxxxxx = True:AttributeError:('xxxxxx',)
 > WinList
 >> WinListItem
 vim.windows[1000]:IndexError:('no such window',)
 > Buffer
 >> StringToLine (indirect)
+vim.current.buffer[0] = u"\na":error:('string cannot contain newlines',)
 vim.current.buffer[0] = "\na":error:('string cannot contain newlines',)
 >> SetBufferLine (indirect)
 vim.current.buffer[0] = True:TypeError:('bad argument type for built-in operation',)
@@ -1075,8 +1165,13 @@ vim.current.buffer.mark("!"):error:('invalid mark name',)
 vim.current.buffer.range(1, 2, 3):TypeError:('function takes exactly 2 arguments (3 given)',)
 > BufMap
 >> BufMapItem
-vim.buffers[None]:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
 vim.buffers[100000000]:KeyError:(100000000,)
+>>> Testing NumberToLong using vim.buffers[%s]
+vim.buffers[[]]:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',)
+vim.buffers[None]:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
+vim.buffers[-1]:ValueError:('number must be greater then zero',)
+vim.buffers[0]:ValueError:('number must be greater then zero',)
+<<< Finished
 > Current
 >> CurrentGetattr
 vim.current.xxx:AttributeError:('xxx',)
@@ -1086,9 +1181,14 @@ vim.current.buffer = True:TypeError:('expected vim.Buffer object, but got bool',
 vim.current.window = True:TypeError:('expected vim.Window object, but got bool',)
 vim.current.tabpage = True:TypeError:('expected vim.TabPage object, but got bool',)
 vim.current.xxx = True:AttributeError:('xxx',)
+['/testdir']
+'/testdir'
 2,xx
 before
 after
+pythonx/topmodule/__init__.py
+pythonx/topmodule/submodule/__init__.py
+pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py
 vim.command("throw 'abcN'"):error:('abcN',)
 Exe("throw 'def'"):error:('def',)
 vim.eval("Exe('throw ''ghi''')"):error:('ghi',)
diff --git a/src/testdir/test87.in b/src/testdir/test87.in
index 6b89117beb..89b0ecb063 100644
--- a/src/testdir/test87.in
+++ b/src/testdir/test87.in
@@ -290,7 +290,7 @@ EOF
 :" threading
 :let l = [0]
 :py3 l=vim.bindeval('l')
-:py3 < Output")
 cb.append(">> OutputSetattr")
 ee('del sys.stdout.softspace')
-ee('sys.stdout.softspace = []')
+number_test('sys.stdout.softspace = %s', unsigned=True)
+number_test('sys.stderr.softspace = %s', unsigned=True)
 ee('sys.stdout.attr = None')
 cb.append(">> OutputWrite")
 ee('sys.stdout.write(None)')
@@ -960,18 +983,34 @@ ee('sys.stdout.writelines(None)')
 ee('sys.stdout.writelines([1])')
 iter_test('sys.stdout.writelines(%s)')
 cb.append("> VimCommand")
-ee('vim.command(1)')
+stringtochars_test('vim.command(%s)')
+ee('vim.command("", 2)')
 #! Not checked: vim->python exceptions translating: checked later
 cb.append("> VimToPython")
 #! Not checked: everything: needs errors in internal python functions
 cb.append("> VimEval")
-ee('vim.eval(1)')
+stringtochars_test('vim.eval(%s)')
+ee('vim.eval("", FailingTrue())')
 #! Not checked: everything: needs errors in internal python functions
 cb.append("> VimEvalPy")
-ee('vim.bindeval(1)')
+stringtochars_test('vim.bindeval(%s)')
+ee('vim.eval("", 2)')
 #! Not checked: vim->python exceptions translating: checked later
 cb.append("> VimStrwidth")
-ee('vim.strwidth(1)')
+stringtochars_test('vim.strwidth(%s)')
+cb.append("> VimForeachRTP")
+ee('vim.foreach_rtp(None)')
+ee('vim.foreach_rtp(NoArgsCall())')
+ee('vim.foreach_rtp(FailingCall())')
+ee('vim.foreach_rtp(int, 2)')
+cb.append('> import')
+old_rtp = vim.options['rtp']
+vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
+ee('import xxx_no_such_module_xxx')
+ee('import failing_import')
+ee('import failing')
+vim.options['rtp'] = old_rtp
+del old_rtp
 cb.append("> Dictionary")
 cb.append(">> DictionaryConstructor")
 ee('vim.Dictionary("abcI")')
@@ -1050,8 +1089,8 @@ cb.append(">> WindowSetattr")
 ee('vim.current.window.buffer = 0')
 ee('vim.current.window.cursor = (100000000, 100000000)')
 ee('vim.current.window.cursor = True')
-ee('vim.current.window.height = "abcK"')
-ee('vim.current.window.width  = "abcL"')
+number_test('vim.current.window.height = %s', unsigned=True)
+number_test('vim.current.window.width = %s', unsigned=True)
 ee('vim.current.window.xxxxxx = True')
 cb.append("> WinList")
 cb.append(">> WinListItem")
@@ -1059,6 +1098,7 @@ ee('vim.windows[1000]')
 cb.append("> Buffer")
 cb.append(">> StringToLine (indirect)")
 ee('vim.current.buffer[0] = "\\na"')
+ee('vim.current.buffer[0] = b"\\na"')
 cb.append(">> SetBufferLine (indirect)")
 ee('vim.current.buffer[0] = True')
 cb.append(">> SetBufferLineList (indirect)")
@@ -1085,8 +1125,8 @@ cb.append(">> BufferRange")
 ee('vim.current.buffer.range(1, 2, 3)')
 cb.append("> BufMap")
 cb.append(">> BufMapItem")
-ee('vim.buffers[None]')
 ee('vim.buffers[100000000]')
+number_test('vim.buffers[%s]', natural=True)
 cb.append("> Current")
 cb.append(">> CurrentGetattr")
 ee('vim.current.xxx')
@@ -1110,12 +1150,16 @@ del Mapping
 del convertfrompyobject_test
 del convertfrompymapping_test
 del iter_test
+del number_test
 del FailingTrue
 del FailingIter
 del FailingIterNext
 del FailingMapping
 del FailingMappingKey
 del FailingList
+del NoArgsCall
+del FailingCall
+del FailingNumber
 EOF
 :delfunction F
 :"
@@ -1124,6 +1168,16 @@ py3 << EOF
 sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
 sys.path.append(os.path.join(os.getcwd(), 'python_after'))
 vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
+l = []
+def callback(path):
+    l.append(os.path.relpath(path))
+vim.foreach_rtp(callback)
+cb.append(repr(l))
+del l
+def callback(path):
+    return os.path.relpath(path)
+cb.append(repr(vim.foreach_rtp(callback)))
+del callback
 from module import dir as d
 from modulex import ddir
 cb.append(d + ',' + ddir)
@@ -1131,10 +1185,19 @@ import before
 cb.append(before.dir)
 import after
 cb.append(after.dir)
+import topmodule as tm
+import topmodule.submodule as tms
+import topmodule.submodule.subsubmodule.subsubsubmodule as tmsss
+cb.append(tm.__file__.replace(os.path.sep, '/')[-len('modulex/topmodule/__init__.py'):])
+cb.append(tms.__file__.replace(os.path.sep, '/')[-len('modulex/topmodule/submodule/__init__.py'):])
+cb.append(tmsss.__file__.replace(os.path.sep, '/')[-len('modulex/topmodule/submodule/subsubmodule/subsubsubmodule.py'):])
 del before
 del after
 del d
 del ddir
+del tm
+del tms
+del tmsss
 EOF
 :"
 :" Test exceptions
@@ -1188,6 +1251,7 @@ EOF
 :call garbagecollect(1)
 :"
 :/^start:/,$wq! test.out
+:" vim: et ts=4 isk-=\:
 :call getchar()
 ENDTEST
 
diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok
index 78b23074ae..9a2d686cd9 100644
--- a/src/testdir/test87.ok
+++ b/src/testdir/test87.ok
@@ -430,7 +430,16 @@ test87.in
 > Output
 >> OutputSetattr
 del sys.stdout.softspace:(, AttributeError("can't delete OutputObject attributes",))
+>>> Testing NumberToLong using sys.stdout.softspace = %s
 sys.stdout.softspace = []:(, TypeError('expected int() or something supporting coercing to int(), but got list',))
+sys.stdout.softspace = None:(, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
+sys.stdout.softspace = -1:(, ValueError('number must be greater or equal to zero',))
+<<< Finished
+>>> Testing NumberToLong using sys.stderr.softspace = %s
+sys.stderr.softspace = []:(, TypeError('expected int() or something supporting coercing to int(), but got list',))
+sys.stderr.softspace = None:(, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
+sys.stderr.softspace = -1:(, ValueError('number must be greater or equal to zero',))
+<<< Finished
 sys.stdout.attr = None:(, AttributeError('invalid attribute: attr',))
 >> OutputWrite
 sys.stdout.write(None):(, TypeError("Can't convert 'NoneType' object to str implicitly",))
@@ -438,24 +447,52 @@ sys.stdout.write(None):(, TypeError("Can't convert 'NoneType'
 sys.stdout.writelines(None):(, TypeError("'NoneType' object is not iterable",))
 sys.stdout.writelines([1]):(, TypeError("Can't convert 'int' object to str implicitly",))
 >>> Testing *Iter* using sys.stdout.writelines(%s)
-sys.stdout.writelines(FailingIter()):(, NotImplementedError())
-sys.stdout.writelines(FailingIterNext()):(, NotImplementedError())
+sys.stdout.writelines(FailingIter()):(, NotImplementedError('iter',))
+sys.stdout.writelines(FailingIterNext()):(, NotImplementedError('next',))
 <<< Finished
 > VimCommand
+>>> Testing StringToChars using vim.command(%s)
 vim.command(1):(, TypeError('expected bytes() or str() instance, but got int',))
+vim.command(b"\0"):(, TypeError('expected bytes with no null',))
+vim.command("\0"):(, TypeError('expected bytes with no null',))
+<<< Finished
+vim.command("", 2):(, TypeError('command() takes exactly one argument (2 given)',))
 > VimToPython
 > VimEval
+>>> Testing StringToChars using vim.eval(%s)
 vim.eval(1):(, TypeError('expected bytes() or str() instance, but got int',))
+vim.eval(b"\0"):(, TypeError('expected bytes with no null',))
+vim.eval("\0"):(, TypeError('expected bytes with no null',))
+<<< Finished
+vim.eval("", FailingTrue()):(, TypeError('function takes exactly 1 argument (2 given)',))
 > VimEvalPy
+>>> Testing StringToChars using vim.bindeval(%s)
 vim.bindeval(1):(, TypeError('expected bytes() or str() instance, but got int',))
+vim.bindeval(b"\0"):(, TypeError('expected bytes with no null',))
+vim.bindeval("\0"):(, TypeError('expected bytes with no null',))
+<<< Finished
+vim.eval("", 2):(, TypeError('function takes exactly 1 argument (2 given)',))
 > VimStrwidth
+>>> Testing StringToChars using vim.strwidth(%s)
 vim.strwidth(1):(, TypeError('expected bytes() or str() instance, but got int',))
+vim.strwidth(b"\0"):(, TypeError('expected bytes with no null',))
+vim.strwidth("\0"):(, TypeError('expected bytes with no null',))
+<<< Finished
+> VimForeachRTP
+vim.foreach_rtp(None):(, TypeError("'NoneType' object is not callable",))
+vim.foreach_rtp(NoArgsCall()):(, TypeError('__call__() takes exactly 1 positional argument (2 given)',))
+vim.foreach_rtp(FailingCall()):(, NotImplementedError('call',))
+vim.foreach_rtp(int, 2):(, TypeError('foreach_rtp() takes exactly one argument (2 given)',))
+> import
+import xxx_no_such_module_xxx:(, ImportError('No module named xxx_no_such_module_xxx',))
+import failing_import:(, ImportError('No module named failing_import',))
+import failing:(, NotImplementedError())
 > Dictionary
 >> DictionaryConstructor
 vim.Dictionary("abcI"):(, ValueError('expected sequence element of size 2, but got sequence of size 1',))
 >> DictionarySetattr
 del d.locked:(, AttributeError('cannot delete vim.Dictionary attributes',))
-d.locked = FailingTrue():(, NotImplementedError())
+d.locked = FailingTrue():(, NotImplementedError('bool',))
 vim.vvars.locked = False:(, TypeError('cannot modify fixed dictionary',))
 d.scope = True:(, AttributeError('cannot set attribute scope',))
 d.xxx = True:(, AttributeError('cannot set attribute xxx',))
@@ -494,14 +531,15 @@ d["a"] = {"abcF" : Mapping({"\0" : 1})}:(, TypeError('expecte
 <<< Finished
 >>> Testing *Iter* using d["a"] = {"abcF" : %s}
 d["a"] = {"abcF" : FailingIter()}:(, TypeError('unable to convert FailingIter to vim structure',))
-d["a"] = {"abcF" : FailingIterNext()}:(, NotImplementedError())
+d["a"] = {"abcF" : FailingIterNext()}:(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using d["a"] = {"abcF" : %s}
 d["a"] = {"abcF" : None}:(, TypeError('unable to convert NoneType to vim structure',))
 d["a"] = {"abcF" : {b"": 1}}:(, ValueError('empty keys are not allowed',))
 d["a"] = {"abcF" : {"": 1}}:(, ValueError('empty keys are not allowed',))
-d["a"] = {"abcF" : FailingMapping()}:(, NotImplementedError())
-d["a"] = {"abcF" : FailingMappingKey()}:(, NotImplementedError())
+d["a"] = {"abcF" : FailingMapping()}:(, NotImplementedError('keys',))
+d["a"] = {"abcF" : FailingMappingKey()}:(, NotImplementedError('getitem:mappingkey',))
+d["a"] = {"abcF" : FailingNumber()}:(, NotImplementedError('int',))
 <<< Finished
 >>> Testing StringToChars using d["a"] = Mapping({%s : 1})
 d["a"] = Mapping({1 : 1}):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -520,34 +558,36 @@ d["a"] = Mapping({"abcG" : Mapping({"\0" : 1})}):(, TypeError
 <<< Finished
 >>> Testing *Iter* using d["a"] = Mapping({"abcG" : %s})
 d["a"] = Mapping({"abcG" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',))
-d["a"] = Mapping({"abcG" : FailingIterNext()}):(, NotImplementedError())
+d["a"] = Mapping({"abcG" : FailingIterNext()}):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using d["a"] = Mapping({"abcG" : %s})
 d["a"] = Mapping({"abcG" : None}):(, TypeError('unable to convert NoneType to vim structure',))
 d["a"] = Mapping({"abcG" : {b"": 1}}):(, ValueError('empty keys are not allowed',))
 d["a"] = Mapping({"abcG" : {"": 1}}):(, ValueError('empty keys are not allowed',))
-d["a"] = Mapping({"abcG" : FailingMapping()}):(, NotImplementedError())
-d["a"] = Mapping({"abcG" : FailingMappingKey()}):(, NotImplementedError())
+d["a"] = Mapping({"abcG" : FailingMapping()}):(, NotImplementedError('keys',))
+d["a"] = Mapping({"abcG" : FailingMappingKey()}):(, NotImplementedError('getitem:mappingkey',))
+d["a"] = Mapping({"abcG" : FailingNumber()}):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing *Iter* using d["a"] = %s
 d["a"] = FailingIter():(, TypeError('unable to convert FailingIter to vim structure',))
-d["a"] = FailingIterNext():(, NotImplementedError())
+d["a"] = FailingIterNext():(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using d["a"] = %s
 d["a"] = None:(, TypeError('unable to convert NoneType to vim structure',))
 d["a"] = {b"": 1}:(, ValueError('empty keys are not allowed',))
 d["a"] = {"": 1}:(, ValueError('empty keys are not allowed',))
-d["a"] = FailingMapping():(, NotImplementedError())
-d["a"] = FailingMappingKey():(, NotImplementedError())
+d["a"] = FailingMapping():(, NotImplementedError('keys',))
+d["a"] = FailingMappingKey():(, NotImplementedError('getitem:mappingkey',))
+d["a"] = FailingNumber():(, NotImplementedError('int',))
 <<< Finished
 >> DictionaryUpdate
 >>> kwargs
 >>> iter
-d.update(FailingMapping()):(, NotImplementedError())
-d.update([FailingIterNext()]):(, NotImplementedError())
+d.update(FailingMapping()):(, NotImplementedError('keys',))
+d.update([FailingIterNext()]):(, NotImplementedError('next',))
 >>> Testing *Iter* using d.update(%s)
-d.update(FailingIter()):(, NotImplementedError())
-d.update(FailingIterNext()):(, NotImplementedError())
+d.update(FailingIter()):(, NotImplementedError('iter',))
+d.update(FailingIterNext()):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing StringToChars using d.update({%s : 1})
 d.update({1 : 1}):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -566,14 +606,15 @@ d.update({"abcF" : Mapping({"\0" : 1})}):(, TypeError('expect
 <<< Finished
 >>> Testing *Iter* using d.update({"abcF" : %s})
 d.update({"abcF" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',))
-d.update({"abcF" : FailingIterNext()}):(, NotImplementedError())
+d.update({"abcF" : FailingIterNext()}):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update({"abcF" : %s})
 d.update({"abcF" : None}):(, TypeError('unable to convert NoneType to vim structure',))
 d.update({"abcF" : {b"": 1}}):(, ValueError('empty keys are not allowed',))
 d.update({"abcF" : {"": 1}}):(, ValueError('empty keys are not allowed',))
-d.update({"abcF" : FailingMapping()}):(, NotImplementedError())
-d.update({"abcF" : FailingMappingKey()}):(, NotImplementedError())
+d.update({"abcF" : FailingMapping()}):(, NotImplementedError('keys',))
+d.update({"abcF" : FailingMappingKey()}):(, NotImplementedError('getitem:mappingkey',))
+d.update({"abcF" : FailingNumber()}):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing StringToChars using d.update(Mapping({%s : 1}))
 d.update(Mapping({1 : 1})):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -592,25 +633,27 @@ d.update(Mapping({"abcG" : Mapping({"\0" : 1})})):(, TypeErro
 <<< Finished
 >>> Testing *Iter* using d.update(Mapping({"abcG" : %s}))
 d.update(Mapping({"abcG" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',))
-d.update(Mapping({"abcG" : FailingIterNext()})):(, NotImplementedError())
+d.update(Mapping({"abcG" : FailingIterNext()})):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update(Mapping({"abcG" : %s}))
 d.update(Mapping({"abcG" : None})):(, TypeError('unable to convert NoneType to vim structure',))
 d.update(Mapping({"abcG" : {b"": 1}})):(, ValueError('empty keys are not allowed',))
 d.update(Mapping({"abcG" : {"": 1}})):(, ValueError('empty keys are not allowed',))
-d.update(Mapping({"abcG" : FailingMapping()})):(, NotImplementedError())
-d.update(Mapping({"abcG" : FailingMappingKey()})):(, NotImplementedError())
+d.update(Mapping({"abcG" : FailingMapping()})):(, NotImplementedError('keys',))
+d.update(Mapping({"abcG" : FailingMappingKey()})):(, NotImplementedError('getitem:mappingkey',))
+d.update(Mapping({"abcG" : FailingNumber()})):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing *Iter* using d.update(%s)
-d.update(FailingIter()):(, NotImplementedError())
-d.update(FailingIterNext()):(, NotImplementedError())
+d.update(FailingIter()):(, NotImplementedError('iter',))
+d.update(FailingIterNext()):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update(%s)
 d.update(None):(, TypeError("'NoneType' object is not iterable",))
 d.update({b"": 1}):(, ValueError('empty keys are not allowed',))
 d.update({"": 1}):(, ValueError('empty keys are not allowed',))
-d.update(FailingMapping()):(, NotImplementedError())
-d.update(FailingMappingKey()):(, NotImplementedError())
+d.update(FailingMapping()):(, NotImplementedError('keys',))
+d.update(FailingMappingKey()):(, NotImplementedError('getitem:mappingkey',))
+d.update(FailingNumber()):(, TypeError("'FailingNumber' object is not iterable",))
 <<< Finished
 >>> Testing StringToChars using d.update(((%s, 0),))
 d.update(((1, 0),)):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -634,14 +677,15 @@ d.update((("a", {"abcF" : Mapping({"\0" : 1})}),)):(, TypeErr
 <<< Finished
 >>> Testing *Iter* using d.update((("a", {"abcF" : %s}),))
 d.update((("a", {"abcF" : FailingIter()}),)):(, TypeError('unable to convert FailingIter to vim structure',))
-d.update((("a", {"abcF" : FailingIterNext()}),)):(, NotImplementedError())
+d.update((("a", {"abcF" : FailingIterNext()}),)):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update((("a", {"abcF" : %s}),))
 d.update((("a", {"abcF" : None}),)):(, TypeError('unable to convert NoneType to vim structure',))
 d.update((("a", {"abcF" : {b"": 1}}),)):(, ValueError('empty keys are not allowed',))
 d.update((("a", {"abcF" : {"": 1}}),)):(, ValueError('empty keys are not allowed',))
-d.update((("a", {"abcF" : FailingMapping()}),)):(, NotImplementedError())
-d.update((("a", {"abcF" : FailingMappingKey()}),)):(, NotImplementedError())
+d.update((("a", {"abcF" : FailingMapping()}),)):(, NotImplementedError('keys',))
+d.update((("a", {"abcF" : FailingMappingKey()}),)):(, NotImplementedError('getitem:mappingkey',))
+d.update((("a", {"abcF" : FailingNumber()}),)):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),))
 d.update((("a", Mapping({1 : 1})),)):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -660,25 +704,27 @@ d.update((("a", Mapping({"abcG" : Mapping({"\0" : 1})})),)):(
 <<< Finished
 >>> Testing *Iter* using d.update((("a", Mapping({"abcG" : %s})),))
 d.update((("a", Mapping({"abcG" : FailingIter()})),)):(, TypeError('unable to convert FailingIter to vim structure',))
-d.update((("a", Mapping({"abcG" : FailingIterNext()})),)):(, NotImplementedError())
+d.update((("a", Mapping({"abcG" : FailingIterNext()})),)):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abcG" : %s})),))
 d.update((("a", Mapping({"abcG" : None})),)):(, TypeError('unable to convert NoneType to vim structure',))
 d.update((("a", Mapping({"abcG" : {b"": 1}})),)):(, ValueError('empty keys are not allowed',))
 d.update((("a", Mapping({"abcG" : {"": 1}})),)):(, ValueError('empty keys are not allowed',))
-d.update((("a", Mapping({"abcG" : FailingMapping()})),)):(, NotImplementedError())
-d.update((("a", Mapping({"abcG" : FailingMappingKey()})),)):(, NotImplementedError())
+d.update((("a", Mapping({"abcG" : FailingMapping()})),)):(, NotImplementedError('keys',))
+d.update((("a", Mapping({"abcG" : FailingMappingKey()})),)):(, NotImplementedError('getitem:mappingkey',))
+d.update((("a", Mapping({"abcG" : FailingNumber()})),)):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing *Iter* using d.update((("a", %s),))
 d.update((("a", FailingIter()),)):(, TypeError('unable to convert FailingIter to vim structure',))
-d.update((("a", FailingIterNext()),)):(, NotImplementedError())
+d.update((("a", FailingIterNext()),)):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using d.update((("a", %s),))
 d.update((("a", None),)):(, TypeError('unable to convert NoneType to vim structure',))
 d.update((("a", {b"": 1}),)):(, ValueError('empty keys are not allowed',))
 d.update((("a", {"": 1}),)):(, ValueError('empty keys are not allowed',))
-d.update((("a", FailingMapping()),)):(, NotImplementedError())
-d.update((("a", FailingMappingKey()),)):(, NotImplementedError())
+d.update((("a", FailingMapping()),)):(, NotImplementedError('keys',))
+d.update((("a", FailingMappingKey()),)):(, NotImplementedError('getitem:mappingkey',))
+d.update((("a", FailingNumber()),)):(, NotImplementedError('int',))
 <<< Finished
 >> DictionaryPopItem
 d.popitem(1, 2):(, TypeError('popitem() takes no arguments (2 given)',))
@@ -689,8 +735,8 @@ d.has_key():(, TypeError('has_key() takes exactly one argumen
 vim.List(1, 2):(, TypeError('function takes at most 1 argument (2 given)',))
 vim.List(a=1):(, TypeError('list constructor does not accept keyword arguments',))
 >>> Testing *Iter* using vim.List(%s)
-vim.List(FailingIter()):(, NotImplementedError())
-vim.List(FailingIterNext()):(, NotImplementedError())
+vim.List(FailingIter()):(, NotImplementedError('iter',))
+vim.List(FailingIterNext()):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing StringToChars using vim.List([{%s : 1}])
 vim.List([{1 : 1}]):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -709,14 +755,15 @@ vim.List([{"abcF" : Mapping({"\0" : 1})}]):(, TypeError('expe
 <<< Finished
 >>> Testing *Iter* using vim.List([{"abcF" : %s}])
 vim.List([{"abcF" : FailingIter()}]):(, TypeError('unable to convert FailingIter to vim structure',))
-vim.List([{"abcF" : FailingIterNext()}]):(, NotImplementedError())
+vim.List([{"abcF" : FailingIterNext()}]):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using vim.List([{"abcF" : %s}])
 vim.List([{"abcF" : None}]):(, TypeError('unable to convert NoneType to vim structure',))
 vim.List([{"abcF" : {b"": 1}}]):(, ValueError('empty keys are not allowed',))
 vim.List([{"abcF" : {"": 1}}]):(, ValueError('empty keys are not allowed',))
-vim.List([{"abcF" : FailingMapping()}]):(, NotImplementedError())
-vim.List([{"abcF" : FailingMappingKey()}]):(, NotImplementedError())
+vim.List([{"abcF" : FailingMapping()}]):(, NotImplementedError('keys',))
+vim.List([{"abcF" : FailingMappingKey()}]):(, NotImplementedError('getitem:mappingkey',))
+vim.List([{"abcF" : FailingNumber()}]):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing StringToChars using vim.List([Mapping({%s : 1})])
 vim.List([Mapping({1 : 1})]):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -735,25 +782,27 @@ vim.List([Mapping({"abcG" : Mapping({"\0" : 1})})]):(, TypeEr
 <<< Finished
 >>> Testing *Iter* using vim.List([Mapping({"abcG" : %s})])
 vim.List([Mapping({"abcG" : FailingIter()})]):(, TypeError('unable to convert FailingIter to vim structure',))
-vim.List([Mapping({"abcG" : FailingIterNext()})]):(, NotImplementedError())
+vim.List([Mapping({"abcG" : FailingIterNext()})]):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using vim.List([Mapping({"abcG" : %s})])
 vim.List([Mapping({"abcG" : None})]):(, TypeError('unable to convert NoneType to vim structure',))
 vim.List([Mapping({"abcG" : {b"": 1}})]):(, ValueError('empty keys are not allowed',))
 vim.List([Mapping({"abcG" : {"": 1}})]):(, ValueError('empty keys are not allowed',))
-vim.List([Mapping({"abcG" : FailingMapping()})]):(, NotImplementedError())
-vim.List([Mapping({"abcG" : FailingMappingKey()})]):(, NotImplementedError())
+vim.List([Mapping({"abcG" : FailingMapping()})]):(, NotImplementedError('keys',))
+vim.List([Mapping({"abcG" : FailingMappingKey()})]):(, NotImplementedError('getitem:mappingkey',))
+vim.List([Mapping({"abcG" : FailingNumber()})]):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing *Iter* using vim.List([%s])
 vim.List([FailingIter()]):(, TypeError('unable to convert FailingIter to vim structure',))
-vim.List([FailingIterNext()]):(, NotImplementedError())
+vim.List([FailingIterNext()]):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using vim.List([%s])
 vim.List([None]):(, TypeError('unable to convert NoneType to vim structure',))
 vim.List([{b"": 1}]):(, ValueError('empty keys are not allowed',))
 vim.List([{"": 1}]):(, ValueError('empty keys are not allowed',))
-vim.List([FailingMapping()]):(, NotImplementedError())
-vim.List([FailingMappingKey()]):(, NotImplementedError())
+vim.List([FailingMapping()]):(, NotImplementedError('keys',))
+vim.List([FailingMappingKey()]):(, NotImplementedError('getitem:mappingkey',))
+vim.List([FailingNumber()]):(, NotImplementedError('int',))
 <<< Finished
 >> ListItem
 l[1000]:(, IndexError('list index out of range',))
@@ -763,8 +812,8 @@ l[1000] = 3:(, IndexError('list index out of range',))
 >> ListAssSlice
 ll[1:100] = "abcJ":(, error('list is locked',))
 >>> Testing *Iter* using l[:] = %s
-l[:] = FailingIter():(, NotImplementedError())
-l[:] = FailingIterNext()::(, NotImplementedError())
+l[:] = FailingIter():(, NotImplementedError('iter',))
+l[:] = FailingIterNext():(, NotImplementedError('next',))
 <<< Finished
 >>> Testing StringToChars using l[:] = [{%s : 1}]
 l[:] = [{1 : 1}]:(, TypeError('expected bytes() or str() instance, but got int',))
@@ -783,14 +832,15 @@ l[:] = [{"abcF" : Mapping({"\0" : 1})}]:(, TypeError('expecte
 <<< Finished
 >>> Testing *Iter* using l[:] = [{"abcF" : %s}]
 l[:] = [{"abcF" : FailingIter()}]:(, TypeError('unable to convert FailingIter to vim structure',))
-l[:] = [{"abcF" : FailingIterNext()}]:(, NotImplementedError())
+l[:] = [{"abcF" : FailingIterNext()}]:(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using l[:] = [{"abcF" : %s}]
 l[:] = [{"abcF" : None}]:(, TypeError('unable to convert NoneType to vim structure',))
 l[:] = [{"abcF" : {b"": 1}}]:(, ValueError('empty keys are not allowed',))
 l[:] = [{"abcF" : {"": 1}}]:(, ValueError('empty keys are not allowed',))
-l[:] = [{"abcF" : FailingMapping()}]:(, NotImplementedError())
-l[:] = [{"abcF" : FailingMappingKey()}]:(, NotImplementedError())
+l[:] = [{"abcF" : FailingMapping()}]:(, NotImplementedError('keys',))
+l[:] = [{"abcF" : FailingMappingKey()}]:(, NotImplementedError('getitem:mappingkey',))
+l[:] = [{"abcF" : FailingNumber()}]:(, NotImplementedError('int',))
 <<< Finished
 >>> Testing StringToChars using l[:] = [Mapping({%s : 1})]
 l[:] = [Mapping({1 : 1})]:(, TypeError('expected bytes() or str() instance, but got int',))
@@ -809,30 +859,32 @@ l[:] = [Mapping({"abcG" : Mapping({"\0" : 1})})]:(, TypeError
 <<< Finished
 >>> Testing *Iter* using l[:] = [Mapping({"abcG" : %s})]
 l[:] = [Mapping({"abcG" : FailingIter()})]:(, TypeError('unable to convert FailingIter to vim structure',))
-l[:] = [Mapping({"abcG" : FailingIterNext()})]:(, NotImplementedError())
+l[:] = [Mapping({"abcG" : FailingIterNext()})]:(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using l[:] = [Mapping({"abcG" : %s})]
 l[:] = [Mapping({"abcG" : None})]:(, TypeError('unable to convert NoneType to vim structure',))
 l[:] = [Mapping({"abcG" : {b"": 1}})]:(, ValueError('empty keys are not allowed',))
 l[:] = [Mapping({"abcG" : {"": 1}})]:(, ValueError('empty keys are not allowed',))
-l[:] = [Mapping({"abcG" : FailingMapping()})]:(, NotImplementedError())
-l[:] = [Mapping({"abcG" : FailingMappingKey()})]:(, NotImplementedError())
+l[:] = [Mapping({"abcG" : FailingMapping()})]:(, NotImplementedError('keys',))
+l[:] = [Mapping({"abcG" : FailingMappingKey()})]:(, NotImplementedError('getitem:mappingkey',))
+l[:] = [Mapping({"abcG" : FailingNumber()})]:(, NotImplementedError('int',))
 <<< Finished
 >>> Testing *Iter* using l[:] = [%s]
 l[:] = [FailingIter()]:(, TypeError('unable to convert FailingIter to vim structure',))
-l[:] = [FailingIterNext()]:(, NotImplementedError())
+l[:] = [FailingIterNext()]:(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using l[:] = [%s]
 l[:] = [None]:(, TypeError('unable to convert NoneType to vim structure',))
 l[:] = [{b"": 1}]:(, ValueError('empty keys are not allowed',))
 l[:] = [{"": 1}]:(, ValueError('empty keys are not allowed',))
-l[:] = [FailingMapping()]:(, NotImplementedError())
-l[:] = [FailingMappingKey()]:(, NotImplementedError())
+l[:] = [FailingMapping()]:(, NotImplementedError('keys',))
+l[:] = [FailingMappingKey()]:(, NotImplementedError('getitem:mappingkey',))
+l[:] = [FailingNumber()]:(, NotImplementedError('int',))
 <<< Finished
 >> ListConcatInPlace
 >>> Testing *Iter* using l.extend(%s)
-l.extend(FailingIter()):(, NotImplementedError())
-l.extend(FailingIterNext()):(, NotImplementedError())
+l.extend(FailingIter()):(, NotImplementedError('iter',))
+l.extend(FailingIterNext()):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing StringToChars using l.extend([{%s : 1}])
 l.extend([{1 : 1}]):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -851,14 +903,15 @@ l.extend([{"abcF" : Mapping({"\0" : 1})}]):(, TypeError('expe
 <<< Finished
 >>> Testing *Iter* using l.extend([{"abcF" : %s}])
 l.extend([{"abcF" : FailingIter()}]):(, TypeError('unable to convert FailingIter to vim structure',))
-l.extend([{"abcF" : FailingIterNext()}]):(, NotImplementedError())
+l.extend([{"abcF" : FailingIterNext()}]):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using l.extend([{"abcF" : %s}])
 l.extend([{"abcF" : None}]):(, TypeError('unable to convert NoneType to vim structure',))
 l.extend([{"abcF" : {b"": 1}}]):(, ValueError('empty keys are not allowed',))
 l.extend([{"abcF" : {"": 1}}]):(, ValueError('empty keys are not allowed',))
-l.extend([{"abcF" : FailingMapping()}]):(, NotImplementedError())
-l.extend([{"abcF" : FailingMappingKey()}]):(, NotImplementedError())
+l.extend([{"abcF" : FailingMapping()}]):(, NotImplementedError('keys',))
+l.extend([{"abcF" : FailingMappingKey()}]):(, NotImplementedError('getitem:mappingkey',))
+l.extend([{"abcF" : FailingNumber()}]):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing StringToChars using l.extend([Mapping({%s : 1})])
 l.extend([Mapping({1 : 1})]):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -877,29 +930,31 @@ l.extend([Mapping({"abcG" : Mapping({"\0" : 1})})]):(, TypeEr
 <<< Finished
 >>> Testing *Iter* using l.extend([Mapping({"abcG" : %s})])
 l.extend([Mapping({"abcG" : FailingIter()})]):(, TypeError('unable to convert FailingIter to vim structure',))
-l.extend([Mapping({"abcG" : FailingIterNext()})]):(, NotImplementedError())
+l.extend([Mapping({"abcG" : FailingIterNext()})]):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using l.extend([Mapping({"abcG" : %s})])
 l.extend([Mapping({"abcG" : None})]):(, TypeError('unable to convert NoneType to vim structure',))
 l.extend([Mapping({"abcG" : {b"": 1}})]):(, ValueError('empty keys are not allowed',))
 l.extend([Mapping({"abcG" : {"": 1}})]):(, ValueError('empty keys are not allowed',))
-l.extend([Mapping({"abcG" : FailingMapping()})]):(, NotImplementedError())
-l.extend([Mapping({"abcG" : FailingMappingKey()})]):(, NotImplementedError())
+l.extend([Mapping({"abcG" : FailingMapping()})]):(, NotImplementedError('keys',))
+l.extend([Mapping({"abcG" : FailingMappingKey()})]):(, NotImplementedError('getitem:mappingkey',))
+l.extend([Mapping({"abcG" : FailingNumber()})]):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing *Iter* using l.extend([%s])
 l.extend([FailingIter()]):(, TypeError('unable to convert FailingIter to vim structure',))
-l.extend([FailingIterNext()]):(, NotImplementedError())
+l.extend([FailingIterNext()]):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using l.extend([%s])
 l.extend([None]):(, TypeError('unable to convert NoneType to vim structure',))
 l.extend([{b"": 1}]):(, ValueError('empty keys are not allowed',))
 l.extend([{"": 1}]):(, ValueError('empty keys are not allowed',))
-l.extend([FailingMapping()]):(, NotImplementedError())
-l.extend([FailingMappingKey()]):(, NotImplementedError())
+l.extend([FailingMapping()]):(, NotImplementedError('keys',))
+l.extend([FailingMappingKey()]):(, NotImplementedError('getitem:mappingkey',))
+l.extend([FailingNumber()]):(, NotImplementedError('int',))
 <<< Finished
 >> ListSetattr
 del l.locked:(, AttributeError('cannot delete vim.List attributes',))
-l.locked = FailingTrue():(, NotImplementedError())
+l.locked = FailingTrue():(, NotImplementedError('bool',))
 l.xxx = True:(, AttributeError('cannot set attribute xxx',))
 > Function
 >> FunctionConstructor
@@ -924,14 +979,15 @@ f({"abcF" : Mapping({"\0" : 1})}):(, TypeError('expected byte
 <<< Finished
 >>> Testing *Iter* using f({"abcF" : %s})
 f({"abcF" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',))
-f({"abcF" : FailingIterNext()}):(, NotImplementedError())
+f({"abcF" : FailingIterNext()}):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using f({"abcF" : %s})
 f({"abcF" : None}):(, TypeError('unable to convert NoneType to vim structure',))
 f({"abcF" : {b"": 1}}):(, ValueError('empty keys are not allowed',))
 f({"abcF" : {"": 1}}):(, ValueError('empty keys are not allowed',))
-f({"abcF" : FailingMapping()}):(, NotImplementedError())
-f({"abcF" : FailingMappingKey()}):(, NotImplementedError())
+f({"abcF" : FailingMapping()}):(, NotImplementedError('keys',))
+f({"abcF" : FailingMappingKey()}):(, NotImplementedError('getitem:mappingkey',))
+f({"abcF" : FailingNumber()}):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing StringToChars using f(Mapping({%s : 1}))
 f(Mapping({1 : 1})):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -950,25 +1006,27 @@ f(Mapping({"abcG" : Mapping({"\0" : 1})})):(, TypeError('expe
 <<< Finished
 >>> Testing *Iter* using f(Mapping({"abcG" : %s}))
 f(Mapping({"abcG" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',))
-f(Mapping({"abcG" : FailingIterNext()})):(, NotImplementedError())
+f(Mapping({"abcG" : FailingIterNext()})):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using f(Mapping({"abcG" : %s}))
 f(Mapping({"abcG" : None})):(, TypeError('unable to convert NoneType to vim structure',))
 f(Mapping({"abcG" : {b"": 1}})):(, ValueError('empty keys are not allowed',))
 f(Mapping({"abcG" : {"": 1}})):(, ValueError('empty keys are not allowed',))
-f(Mapping({"abcG" : FailingMapping()})):(, NotImplementedError())
-f(Mapping({"abcG" : FailingMappingKey()})):(, NotImplementedError())
+f(Mapping({"abcG" : FailingMapping()})):(, NotImplementedError('keys',))
+f(Mapping({"abcG" : FailingMappingKey()})):(, NotImplementedError('getitem:mappingkey',))
+f(Mapping({"abcG" : FailingNumber()})):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing *Iter* using f(%s)
 f(FailingIter()):(, TypeError('unable to convert FailingIter to vim structure',))
-f(FailingIterNext()):(, NotImplementedError())
+f(FailingIterNext()):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using f(%s)
 f(None):(, TypeError('unable to convert NoneType to vim structure',))
 f({b"": 1}):(, ValueError('empty keys are not allowed',))
 f({"": 1}):(, ValueError('empty keys are not allowed',))
-f(FailingMapping()):(, NotImplementedError())
-f(FailingMappingKey()):(, NotImplementedError())
+f(FailingMapping()):(, NotImplementedError('keys',))
+f(FailingMappingKey()):(, NotImplementedError('getitem:mappingkey',))
+f(FailingNumber()):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing StringToChars using fd(self={%s : 1})
 fd(self={1 : 1}):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -987,14 +1045,15 @@ fd(self={"abcF" : Mapping({"\0" : 1})}):(, TypeError('expecte
 <<< Finished
 >>> Testing *Iter* using fd(self={"abcF" : %s})
 fd(self={"abcF" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',))
-fd(self={"abcF" : FailingIterNext()}):(, NotImplementedError())
+fd(self={"abcF" : FailingIterNext()}):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using fd(self={"abcF" : %s})
 fd(self={"abcF" : None}):(, TypeError('unable to convert NoneType to vim structure',))
 fd(self={"abcF" : {b"": 1}}):(, ValueError('empty keys are not allowed',))
 fd(self={"abcF" : {"": 1}}):(, ValueError('empty keys are not allowed',))
-fd(self={"abcF" : FailingMapping()}):(, NotImplementedError())
-fd(self={"abcF" : FailingMappingKey()}):(, NotImplementedError())
+fd(self={"abcF" : FailingMapping()}):(, NotImplementedError('keys',))
+fd(self={"abcF" : FailingMappingKey()}):(, NotImplementedError('getitem:mappingkey',))
+fd(self={"abcF" : FailingNumber()}):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing StringToChars using fd(self=Mapping({%s : 1}))
 fd(self=Mapping({1 : 1})):(, TypeError('expected bytes() or str() instance, but got int',))
@@ -1013,14 +1072,15 @@ fd(self=Mapping({"abcG" : Mapping({"\0" : 1})})):(, TypeError
 <<< Finished
 >>> Testing *Iter* using fd(self=Mapping({"abcG" : %s}))
 fd(self=Mapping({"abcG" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',))
-fd(self=Mapping({"abcG" : FailingIterNext()})):(, NotImplementedError())
+fd(self=Mapping({"abcG" : FailingIterNext()})):(, NotImplementedError('next',))
 <<< Finished
 >>> Testing ConvertFromPyObject using fd(self=Mapping({"abcG" : %s}))
 fd(self=Mapping({"abcG" : None})):(, TypeError('unable to convert NoneType to vim structure',))
 fd(self=Mapping({"abcG" : {b"": 1}})):(, ValueError('empty keys are not allowed',))
 fd(self=Mapping({"abcG" : {"": 1}})):(, ValueError('empty keys are not allowed',))
-fd(self=Mapping({"abcG" : FailingMapping()})):(, NotImplementedError())
-fd(self=Mapping({"abcG" : FailingMappingKey()})):(, NotImplementedError())
+fd(self=Mapping({"abcG" : FailingMapping()})):(, NotImplementedError('keys',))
+fd(self=Mapping({"abcG" : FailingMappingKey()})):(, NotImplementedError('getitem:mappingkey',))
+fd(self=Mapping({"abcG" : FailingNumber()})):(, NotImplementedError('int',))
 <<< Finished
 >>> Testing *Iter* using fd(self=%s)
 fd(self=FailingIter()):(, TypeError('unable to convert FailingIter to vim dictionary',))
@@ -1030,8 +1090,9 @@ fd(self=FailingIterNext()):(, TypeError('unable to convert Fa
 fd(self=None):(, TypeError('unable to convert NoneType to vim dictionary',))
 fd(self={b"": 1}):(, ValueError('empty keys are not allowed',))
 fd(self={"": 1}):(, ValueError('empty keys are not allowed',))
-fd(self=FailingMapping()):(, NotImplementedError())
-fd(self=FailingMappingKey()):(, NotImplementedError())
+fd(self=FailingMapping()):(, NotImplementedError('keys',))
+fd(self=FailingMappingKey()):(, NotImplementedError('getitem:mappingkey',))
+fd(self=FailingNumber()):(, TypeError('unable to convert FailingNumber to vim dictionary',))
 <<< Finished
 >>> Testing ConvertFromPyMapping using fd(self=%s)
 fd(self=[]):(, AttributeError('keys',))
@@ -1049,8 +1110,16 @@ vim.current.window.xxx:(, AttributeError("'vim.window' o
 vim.current.window.buffer = 0:(, TypeError('readonly attribute: buffer',))
 vim.current.window.cursor = (100000000, 100000000):(, error('cursor position outside buffer',))
 vim.current.window.cursor = True:(, TypeError('argument must be 2-item sequence, not bool',))
-vim.current.window.height = "abcK":(, TypeError('expected int() or something supporting coercing to int(), but got str',))
-vim.current.window.width  = "abcL":(, TypeError('expected int() or something supporting coercing to int(), but got str',))
+>>> Testing NumberToLong using vim.current.window.height = %s
+vim.current.window.height = []:(, TypeError('expected int() or something supporting coercing to int(), but got list',))
+vim.current.window.height = None:(, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
+vim.current.window.height = -1:(, ValueError('number must be greater or equal to zero',))
+<<< Finished
+>>> Testing NumberToLong using vim.current.window.width = %s
+vim.current.window.width = []:(, TypeError('expected int() or something supporting coercing to int(), but got list',))
+vim.current.window.width = None:(, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
+vim.current.window.width = -1:(, ValueError('number must be greater or equal to zero',))
+<<< Finished
 vim.current.window.xxxxxx = True:(, AttributeError('xxxxxx',))
 > WinList
 >> WinListItem
@@ -1058,6 +1127,7 @@ vim.windows[1000]:(, IndexError('no such window',))
 > Buffer
 >> StringToLine (indirect)
 vim.current.buffer[0] = "\na":(, error('string cannot contain newlines',))
+vim.current.buffer[0] = b"\na":(, error('string cannot contain newlines',))
 >> SetBufferLine (indirect)
 vim.current.buffer[0] = True:(, TypeError('bad argument type for built-in operation',))
 >> SetBufferLineList (indirect)
@@ -1084,8 +1154,13 @@ vim.current.buffer.mark("!"):(, error('invalid mark name',))
 vim.current.buffer.range(1, 2, 3):(, TypeError('function takes exactly 2 arguments (3 given)',))
 > BufMap
 >> BufMapItem
-vim.buffers[None]:(, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
 vim.buffers[100000000]:(, KeyError(100000000,))
+>>> Testing NumberToLong using vim.buffers[%s]
+vim.buffers[[]]:(, TypeError('expected int() or something supporting coercing to int(), but got list',))
+vim.buffers[None]:(, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
+vim.buffers[-1]:(, ValueError('number must be greater then zero',))
+vim.buffers[0]:(, ValueError('number must be greater then zero',))
+<<< Finished
 > Current
 >> CurrentGetattr
 vim.current.xxx:(, AttributeError("'vim.currentdata' object has no attribute 'xxx'",))
@@ -1095,9 +1170,14 @@ vim.current.buffer = True:(, TypeError('expected vim.Buffer o
 vim.current.window = True:(, TypeError('expected vim.Window object, but got bool',))
 vim.current.tabpage = True:(, TypeError('expected vim.TabPage object, but got bool',))
 vim.current.xxx = True:(, AttributeError('xxx',))
+['.']
+'.'
 3,xx
 before
 after
+pythonx/topmodule/__init__.py
+pythonx/topmodule/submodule/__init__.py
+pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py
 vim.command("throw 'abcN'"):(, error('abcN',))
 Exe("throw 'def'"):(, error('def',))
 vim.eval("Exe('throw ''ghi''')"):(, error('ghi',))
diff --git a/src/version.c b/src/version.c
index a32f4940bb..cad526223c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,42 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1251,
+/**/
+    1250,
+/**/
+    1249,
+/**/
+    1248,
+/**/
+    1247,
+/**/
+    1246,
+/**/
+    1245,
+/**/
+    1244,
+/**/
+    1243,
+/**/
+    1242,
+/**/
+    1241,
+/**/
+    1240,
+/**/
+    1239,
+/**/
+    1238,
+/**/
+    1237,
+/**/
+    1236,
+/**/
+    1235,
+/**/
+    1234,
 /**/
     1233,
 /**/
diff --git a/src/window.c b/src/window.c
index 910ba9cdd9..5477431777 100644
--- a/src/window.c
+++ b/src/window.c
@@ -66,6 +66,11 @@ static void clear_snapshot_rec __ARGS((frame_T *fr));
 static int check_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
 static win_T *restore_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
 
+static int frame_check_height __ARGS((frame_T *topfrp, int height));
+#ifdef FEAT_VERTSPLIT
+static int frame_check_width __ARGS((frame_T *topfrp, int width));
+#endif
+
 #endif /* FEAT_WINDOWS */
 
 static win_T *win_alloc __ARGS((win_T *after, int hidden));
@@ -4754,7 +4759,7 @@ shell_new_rows()
     /* First try setting the heights of windows with 'winfixheight'.  If
      * that doesn't result in the right height, forget about that option. */
     frame_new_height(topframe, h, FALSE, TRUE);
-    if (topframe->fr_height != h)
+    if (!frame_check_height(topframe, h))
 	frame_new_height(topframe, h, FALSE, FALSE);
 
     (void)win_comp_pos();		/* recompute w_winrow and w_wincol */
@@ -4788,7 +4793,7 @@ shell_new_columns()
     /* First try setting the widths of windows with 'winfixwidth'.  If that
      * doesn't result in the right width, forget about that option. */
     frame_new_width(topframe, (int)Columns, FALSE, TRUE);
-    if (topframe->fr_width != Columns)
+    if (!frame_check_width(topframe, Columns))
 	frame_new_width(topframe, (int)Columns, FALSE, FALSE);
 
     (void)win_comp_pos();		/* recompute w_winrow and w_wincol */
@@ -6932,3 +6937,48 @@ get_tab_number(tabpage_T *tp UNUSED)
 	return i;
 }
 #endif
+
+/*
+ * Return TRUE if "topfrp" and its children are at the right height.
+ */
+    static int
+frame_check_height(topfrp, height)
+    frame_T *topfrp;
+    int	    height;
+{
+    frame_T *frp;
+
+    if (topfrp->fr_height != height)
+	return FALSE;
+
+    if (topfrp->fr_layout == FR_ROW)
+	for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next)
+	    if (frp->fr_height != height)
+		return FALSE;
+
+    return TRUE;
+}
+
+#ifdef FEAT_VERTSPLIT
+/*
+ * Return TRUE if "topfrp" and its children are at the right width.
+ */
+    static int
+frame_check_width(topfrp, width)
+    frame_T *topfrp;
+    int	    width;
+{
+    frame_T *frp;
+
+    if (topfrp->fr_width != width)
+	return FALSE;
+
+    if (topfrp->fr_layout == FR_COL)
+	for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next)
+	    if (frp->fr_width != width)
+		return FALSE;
+
+    return TRUE;
+}
+#endif
+