Friday, March 4, 2016

Re: Packages

On 4 March 2016, Nikolay Aleksandrovich Pavlov <zyx.vim@gmail.com>
wrote:
> 2016-03-04 14:55 GMT+03:00 LCD 47 <lcd047@gmail.com>:
> > On 4 March 2016, Nikolay Aleksandrovich Pavlov <zyx.vim@gmail.com>
> > wrote:
> >> 2016-03-04 14:25 GMT+03:00 LCD 47 <lcd047@gmail.com>:
> >> > On 3 March 2016, Bram Moolenaar <Bram@moolenaar.net> 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

Right, my question was ambiguous. Sadly, a try / catch is not
apropriate for my situation. I realy need to know whether the plugin
is installed or not. I also need to be able to decide that without
actually triggering the autoload. So I suppose the question becomes: if

globpath(&runtimepath, "autoload/foo.vim", 1)

returns empty, can I conclude "foo" is either not installed with the new
scheme, or not enabled?

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

/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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: