On Sun, 11 Jul 2010, tyru wrote:

> > Bram
> > This works as intended.  Autoload scripts are only loaded when used.
> > Not when you check if something defined in it exists.
> 
> This is expected behavior?
> hmm, but checking this at command-line, exists() returns 1.
>     :echo exists('*mylib#func')
> and seeing :scriptnames, autoload/mylib.vim has been loaded.

The expected behavior is for it to return 0.  But, as tyru is seeing, 
I'm also getting the unexpected return of 1 with the following, simpler setup:

===> /tmp/just-autoload/vimrc <===
let &rtp='/tmp/just-autoload,'.&rtp
fun! TestExists()
    echo '(expected) in TestExists:' exists('*mylib#func')
endfun
call TestExists()
echo '(unexpected) in vimrc:' exists('*mylib#func')
quit

===> /tmp/just-autoload/autoload/mylib.vim <===
fun! mylib#func()
    " function never gets called
    echo "(not printed:) called mylib#func()"
endfun

$ vim -U NONE -N -u /tmp/just-autoload/vimrc
(expected) in TestExists: 0
(unexpected) in vimrc: 1

-- 
Best,
Ben

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

Reply via email to