2016-03-04 14:55 GMT+03:00 LCD 47 <[email protected]>:
> On 4 March 2016, Nikolay Aleksandrovich Pavlov <[email protected]> wrote:
>> 2016-03-04 14:25 GMT+03:00 LCD 47 <[email protected]>:
>> > On 3 March 2016, Bram Moolenaar <[email protected]> wrote:
>> > [...]
>> >> I realize several people who have previously been using Pathogen
>> >> are confused.  Perhaps we can just put every directory under
>> >> "pack/*/ever" in 'runtimepath'?
>> >
>> >     A tangentially related question.  Assume I need to check that
>> > a plugin named "foo" is installed and enabled.  Assume also "foo"
>> > contains
>>
>> If you need to check that it is installed and *enabled* then you
>> should not do anything you are not already doing.
>
>     So if
>
>         globpath(&runtimepath, "autoload/foo.vim", 1) != ""
>
> returns true, I can assume "foo" is installed and enabled?

Yes. Though if you can it is probably better to wrap the function calls into

    function s:CallFooBar(...)
        try
            return call('foo#bar', a:000)
        catch /^Vim(return):E117:/
            return 0
        endtry
    endfunction

: I sometimes saw and have developed plugin lazy loader which uses
FuncUndefined event to load a plugin. Even with the hacks I know such
loaders are only fully compatible with [EAFP][1] approach (my lazy
loader also throws some strange errors, so it is not yet in VAM
master; and in any case I never had plans to enable it by default).

This, of course, means that you are assumed to handle absence of
foo#bar where you need it, not base any decisions on prelimitary
checks.

[1]: https://docs.python.org/3/glossary.html#term-eafp


>
>> Problem is that with “just put every directory under pack/*/ever”
>> you probably will not be able to do this from the vimrc: rationale is
>> that
>>
>> 1. Putting should be automatic.
>> 2. Yet user settings regarding where “pack” is should be respected.
>>
>> So “just put” should be done somewhere between “load vimrc” and “load
>> plugins” initialization stages.
>
>     I'm trying to write a plugin that happens to need "foo", not a
> plugin manager.  I don't want to install "foo" if it's missing, I just
> want to know if I can call "foo#bar()".  Checking for the function
> itself is not reliable:
>
>         exists("*foo#bar")
>
> returns false if the corresponding autoload file is not already loaded.
> I also don't want to load the file just to make sure I can use the
> function at some later point in time.
>
>     /lcd
>
> --
> --
> You received this message from the "vim_use" 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_use" 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/d/optout.

-- 
-- 
You received this message from the "vim_use" 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_use" 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/d/optout.

Reply via email to