Right, thanks.  I am pretty close.  I am just trying to make the code more
tidy.  It was not quite as I thought.  Since the plugin name cannot have
more than one ".", one can scan for the number of "." to decide which
course of action to take.

On Sat, Jun 3, 2017 at 2:34 PM, Terry Brown <terrynbr...@gmail.com> wrote:

> On Sat, 3 Jun 2017 05:52:07 -0500
> "Edward K. Ream" <edream...@gmail.com> wrote:
>
> > On Fri, Jun 2, 2017 at 9:44 PM, Terry Brown <terrynbr...@gmail.com>
> > wrote:
> >
> > > On Fri, 2 Jun 2017 16:41:27 -0700 (PDT)
> > > Adrian Calvin <developer.adr...@gmail.com> wrote:
> > >
> > > > Is there a way to add additional plugin directories to leo just as
> > > > one might add additional paths to python?
> > >
> > > Yes.
> > >
> > > I think, from memory, the rule for plugins named in
> > > @enabled-plugins is that foo.py will be looked for in
> > > <leo-dir>/plugins.  However, I believe foo or for.bar will be
> > > looked for on the Python path like any other module.  Not sure if
> > > ~/.leo/plugins gets any special treatment or not.
> > >
> >
> > ​That's not how the code works.  In order to check whether a module
> > has been loaded, the code uses module names, not file names.  See ​
> >
> > ​LeoPluginsController.​regularizeName.  As a result, plugins can only
> > appear in subdirectories of leo/plugins.
>
> Well, I just tried this:
>
>  - add `nonesuch` (no .py) to enabled-plugins.
>  - exit Leo
>  - start Leo - reports failure to load plugin nonesuch
>  - exit Leo
>  - mkdir /tmp/here
>  - touch /tmp/here/nonesuch.py
>  - start Leo with /tmp/here on PYTHONPATH
>  - does not report any failure, nonesuch in plugins menu
>
> => Leo searches Python's path for, well, for modules, but in effect for
>    plugins.  I think the case where they must be in leo/plugins might be
>    when the name in enabled-plugins ends in .py
>
> Cheers -Terry
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "leo-editor" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/leo-editor/-SjlfMRl1vg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> leo-editor+unsubscr...@googlegroups.com.
> To post to this group, send email to leo-editor@googlegroups.com.
> Visit this group at https://groups.google.com/group/leo-editor.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to