Am 04.06.2013 17:32, schrieb Andy Wokula:
Am 04.06.2013 15:16, schrieb lilydjwg:
In Vim version <= 7.3.1031, the following code works and finds the
correct function:

:echo function('<SNR>138_JumpToEndForward')

Of course, change '138_JumpToEndForward' to some 's:' prefixed function
Vim knows.

With Vim version >= 7.3.1071, it returns a string like
'<80><fd>R138_JumpToEndForward' and the result can't be called.

This breaks the CountJump plugin. At least 'mail_movement' that using
it, when editing an Email message, '][' throws an error:

E129: Function name required
E700: Unknown function: <80>ýJumpToEndForward
E488: Trailing characters

I guess this is caused by patch 7.3.1058:
"Call of funcref does not succeed in other script."

Problem is caused by using the return value of function() to define a mapping:


func! <sid>Foo()
    return 'OK'
endfunc

map <SID> <SID>
let s:SID = maparg("<SID>")
unmap <SID>

exec 'nmap ][ :echo '. string(function(s:SID.'Foo')). '()<CR>'
" this fails for   enc=utf-8
" this is ok for   enc=latin1

finish


" :echo string(function(s:SID.'Foo'))
" => function('€ýR123_Foo')         (7.3.1058 and later)
" => function('<SNR>123_Foo')       (older Vim)

" this simpler approach still works:
exec 'nmap ][ :echo '. s:SID.'Foo'. '()<CR>'


not sure about a solution ...

--
Andy

--
--
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