Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError occurs in SpliceInit #19

Open
xoi opened this issue Jul 7, 2013 · 2 comments
Open

KeyError occurs in SpliceInit #19

xoi opened this issue Jul 7, 2013 · 2 comments

Comments

@xoi
Copy link

xoi commented Jul 7, 2013

KeyError following occurs when I run vim 1 2 3 4 -c SpliceInit.

Error detected while processing function splice#SpliceInit:
line    2:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/test/.vim/autoload/splice.py", line 13, in <module>
    import splicelib.init as splice
  File "/home/test/.vim/autoload/splicelib/init.py", line 2, in <module>
    import modes
  File "/home/test/.vim/autoload/splicelib/modes.py", line 894, in <module>
    compare = CompareMode()
  File "/home/test/.vim/autoload/splicelib/modes.py", line 512, in __init__
    self._current_buffer_first = buffers.original
  File "/home/test/.vim/autoload/splicelib/util/bufferlib.py", line 37, in original
    return Buffer(0)
  File "/home/test/.vim/autoload/splicelib/util/bufferlib.py", line 10, in __init__
    self._buffer = vim.buffers[i]
KeyError: 0
line    3:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'SpliceInit' is not defined

It seems to have occurred by accessing vim.buffers[0].

I suspect the impact of Patch 7.3.945.

Patch 7.3.945
Problem: Python: List of buffers is not very useful.
Solution: Make vim.buffers a map. No iterator yet. (ZyX)

ftp://ftp.vim.org/pub/vim/patches/7.3/7.3.945

In the following states,

:ls
  1 %a   "1"                            line 1
  2      "2"                            line 0
  3      "3"                            line 0
  4      "4"                            line 0

when I run the following:

python print vim.buffers[0]
python print vim.buffers[1]
python print vim.buffers[2]
python print vim.buffers[3]
python print vim.buffers[4]
python print vim.buffers[5]

It will be the following results:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
KeyError: 0
<buffer 1>
<buffer 2>
<buffer 3>
<buffer 4>
Traceback (most recent call last):
  File "<string>", line 1, in <module>
KeyError: 5

Index of vim.buffers is made to 1-4 in this case.

version:
  • VIM 7.3.1214
  • Python 2.7.5
@xoi
Copy link
Author

xoi commented Jul 7, 2013

It seems like the same as #17. Error name is different, though.

@jcf
Copy link

jcf commented Aug 6, 2013

Same thing here with the following Vim version:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul  1 2013 20:47:38)
MacOS X (unix) version
Included patches: 1-1251
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+arabic          +cmdline_info    -ebcdic          +fork()          +lispindent      -mouse_jsbterm   +path_extra      +ruby            -tag_any_white   +visual          -xsmp
+autocmd         +comments        +emacs_tags      +fullscreen      +listcmds        +mouse_netterm   +perl            +scrollbind      +tcl             +visualextra     -xterm_clipboard
+balloon_eval    +conceal         +eval            -gettext         +localmap        +mouse_sgr       +persistent_undo +signs           +terminfo        +viminfo         -xterm_save
+browse          +cryptv          +ex_extra        -hangul_input    +lua             -mouse_sysmouse  +postscript      +smartindent     +termresponse    +vreplace
++builtin_terms  +cscope          +extra_search    +iconv           +menu            +mouse_urxvt     +printer         -sniff           +textobjects     +wildignore
+byte_offset     +cursorbind      +farsi           +insert_expand   +mksession       +mouse_xterm     +profile         +startuptime     +title           +wildmenu
+cindent         +cursorshape     +file_in_path    +jumplist        +modify_fname    +multi_byte      +python          +statusline      +toolbar         +windows
+clientserver    +dialog_con_gui  +find_in_path    +keymap          +mouse           +multi_lang      -python3         -sun_workshop    +transparency    +writebackup
+clipboard       +diff            +float           +langmap         +mouseshape      -mzscheme        +quickfix        +syntax          +user_commands   -X11
+cmdline_compl   +digraphs        +folding         +libcall         +mouse_dec       +netbeans_intg   +reltime         +tag_binary      +vertsplit       -xfontset
+cmdline_hist    +dnd             -footer          +linebreak       -mouse_gpm       +odbeditor       +rightleft       +tag_old_static  +virtualedit     +xim
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX -no-cpp-precomp  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/
System/Library/Frameworks/Tcl.framework/Headers  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_DARWIN_C_SOURCE=1
Linking: clang   -L.   -L.    -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lncurses -liconv -framework Cocoa  -L/usr/local/lib -llua -fstack-protector -L/usr/local/l
ib  -L/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -framework Python  -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework
Ruby

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants