On Aug 21, 2013 11:56 PM, "Gary Johnson" <[email protected]> wrote:
>
> I've been using Steve Losh's excellent Splice plugin to perform
> merges under Perforce.  This worked fine with Vim 7.3.882 but it
> fails horribly with Vim 7.4.  I have in my environment
>
>     P4MERGE=p4merge-splice
>
> where p4merge-splice is the following script:
>
>     exec vim $1 $2 $3 $4 -c 'set ch+=2' -c 'SpliceInit' -c 'set ch-=2'
>
> I just tried to use it to help me perform a merge with 'p4 resolve'
> and got the following stream of errors from Vim.
>
>     Error detected while processing function splice#SpliceInit:
>     line    2:
>     Traceback (most recent call last):
>       File "<string>", line 1, in <module>
>       File "/home/gajohnso/.vim/splice/autoload/splice.py", line 13, in
<module>
>         import splicelib.init as splice
>       File "/home/gajohnso/.vim/splice/autoload/splicelib/init.py", line
2, in <module>
>         import modes
>       File "/home/gajohnso/.vim/splice/autoload/splicelib/modes.py", line
894, in <module>
>         compare = CompareMode()
>       File "/home/gajohnso/.vim/splice/autoload/splicelib/modes.py", line
512, in __init__
>         self._current_buffer_first = buffers.original
>       File
"/home/gajohnso/.vim/splice/autoload/splicelib/util/bufferlib.py", line 37,
in original
>         return Buffer(0)
>       File
"/home/gajohnso/.vim/splice/autoload/splicelib/util/bufferlib.py", line 10,
in __init__
>         self._buffer = vim.buffers[i]
>     ValueError: number must be greater then zero
>     line    3:
>     Traceback (most recent call last):
>       File "<string>", line 1, in <module>
>     NameError: name 'SpliceInit' is not defined
>     Press ENTER or type command to continue
>
> After changing the p4merge-splice script to use the old 7.3.882 Vim,
> it worked fine again.
>
> Here is :version from my 7.4 Vim.
>
>     $ vim --version
>     VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 12 2013 12:27:07)
>     Compiled by [email protected]
>     Normal version with GTK2 GUI.  Features included (+) or not (-):
>     -arabic          +file_in_path    -mouse_sgr       +tag_binary
>     +autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
>     +balloon_eval    +float           -mouse_urxvt     -tag_any_white
>     +browse          +folding         +mouse_xterm     -tcl
>     +builtin_terms   -footer          +multi_byte      +terminfo
>     +byte_offset     +fork()          +multi_lang      +termresponse
>     +cindent         +gettext         -mzscheme        +textobjects
>     +clientserver    -hangul_input    +netbeans_intg   +title
>     +clipboard       +iconv           +path_extra      +toolbar
>     +cmdline_compl   +insert_expand   -perl            +user_commands
>     +cmdline_hist    +jumplist        +persistent_undo +vertsplit
>     +cmdline_info    -keymap          +postscript      +virtualedit
>     +comments        -langmap         +printer         +visual
>     -conceal         +libcall         -profile         +visualextra
>     +cryptv          +linebreak       +python          +viminfo
>     +cscope          +lispindent      -python3         +vreplace
>     +cursorbind      +listcmds        +quickfix        +wildignore
>     +cursorshape     +localmap        +reltime         +wildmenu
>     +dialog_con_gui  -lua             -rightleft       +windows
>     +diff            +menu            -ruby            +writebackup
>     +digraphs        +mksession       +scrollbind      +X11
>     +dnd             +modify_fname    +signs           -xfontset
>     -ebcdic          +mouse           +smartindent     +xim
>     -emacs_tags      +mouseshape      -sniff           +xsmp_interact
>     +eval            -mouse_dec       +startuptime     +xterm_clipboard
>     +ex_extra        +mouse_gpm       +statusline      -xterm_save
>     +extra_search    -mouse_jsbterm   -sun_workshop
>     -farsi           -mouse_netterm   +syntax
>        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: "/home/gajohnso/src/vim-7.4/share/vim"
>     Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng12     -g -U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=1
>     Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim
-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0
-lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype
-lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0   -lSM -lICE -lXpm -lXt
-lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl  -lselinux  -lacl -lattr
-lgpm    -L/usr/lib/python2.6/config -lpython2.6 -lpthread -ldl -lutil -lm
-Xlinker -export-dynamic
>
> 'hg tip' shows this version of Splice and 'hg incoming' says there
> are no newer changes.
>
>     changeset:   100:01e68795c7a1
>     tag:         tip
>     user:        Steve Losh <[redacted]>
>     date:        Wed Feb 06 11:16:24 2013 -0500
>     summary:     Remove unused function.
>
> What went wrong and how can I fix it?  Or is this a bug in Vim 7.4?
>
> Regards,
> Gary

No, this is not a bug. Index of buffer within vim.buffers used to be an
unknown integer: it was index of underlying C linked list of buffers. I
changed the code to make it more meaningful: now this index is buffer
number. But there is no buffer number zero.

Guess it was better to make it more like vim.windows for such cases (index
in vim.windows is window number-1). To get first buffer regardless of what
vim version is one has to use next(iter(vim.buffers)).

Note that the following code (it is the one that raises an exception) is
incorrect in any vim:

class Buffer(object):
    def __init__(self, i):
        self.number = i + 1
        self._buffer = vim.buffers[i]
        self.name = self._buffer.name

: buffer number was NEVER equal to buffer index in vim.buffers incremented
by 1. It may be eventually equal, but only until you delete some buffer
that was created earlier then the buffer you seek. To make it work
correctly before and after my change one should write

    for b in vim.buffers:
        if b.number == self.number:
            self._buffer = b
            break

in place of the second line in __init__.

> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
"vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui