On Sat, Aug 9, 2014 at 8:24 AM, Edward K. Ream <edream...@gmail.com> wrote:

> I'll attempt a fix today.

I inserted a trace in AutoCompleterClass.get_leo_namespace::

    def get_leo_namespace (self,prefix):
        '''
        Return an environment in which to evaluate prefix.
        Add some common standard library modules as needed.
        '''
        trace = True and not g.unitTesting
        k = self.k
        d = {'c':k.c, 'p':k.c.p, 'g':g}
        aList = prefix.split('.')
        if len(aList) > 1:
            name = aList[0]
            m = sys.modules.get(name)
            if m:
                d[name]= m
        if trace:
            g.trace('prefix',prefix,'aList',aList)
            for key in sorted(d.keys()):
                g.trace(key,d.get(key))
        return

Here is what it reported (minus the leading method name)::

prefix c. aList [u'c', u'']
c <module 'c' from '...\leo\plugins\importers\c.pyc'>
g <module 'leo.core.leoGlobals' from '...\leo\core\leoGlobals.pyc'>
p <pos 168544912 childIndex: 5 lvl: 0 key: 118966416:5 autocompleter test>

So now it's clear what is happening: the module defined in
leo/plugins/importers/c.py is polluting the global namespace.  That
is, it is entered into sys.modules as "c" rather than
"leo.plugins.importers.c".

You would think it would be easy to change that, but as I recall there
is a problem with rst.py.  It, at least, must be entered "bare", or
docutils will barf. Big sigh.

I think Leo must special case rst.py.  Btw, there is already a special
case for docutils, the importer is leo.plugins.importers.leo_rst.

I'll have to think about this...

Edward
--------------------------------------------------------------
Edward K. Ream: edream...@gmail.com Leo: http://leoeditor.com/
Speak the truth, but not to punish--Thich Nhat Hanh
------------------------------------------------------------------------------------------

-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to