On Tue, Oct 11, 2011 at 10:50 AM, Edward K. Ream <[email protected]> wrote: > On Tue, Oct 11, 2011 at 10:15 AM, Kent Tenney <[email protected]> wrote: > >> So, I'm looking at a function, wondering where that global came from. >> Not in <file> declarations node ... finally ... it was between 2 func >> defs above, showed up in the node for the func def which followed it. >> >> We've discussed this at some length, was the conclusion that this >> is optimal or did we punt? > > It's common practices to put aliases for functions/methods following > the actual definition. > > I think I understand your concern. *Usually* when we see something > like a function call, we can search for "def <function name>. But > that won't work if the name is an alias for another function/method. > > But this doesn't really have anything much to do with @auto: the > problem exists for all kinds of @<file> nodes. One can imagine a > regex that would search for whatever, but typing such a beast will not > be fun. Once can also imagine a command that would search for various > items, but that doesn't exist yet. > > As far as @auto goes, I think the present way strikes a good balance. > It will always be necessary to make by-hand adjustments. That can't > be helped. But the join-node-above/below buttons go a long way in > easing the tedium. > >> I think the minimum improvement would be to create additional >> "Declarations" nodes with an exception for decorators, which >> would be placed with their decoratee. > > There are limits to the kinds of AI that I am willing consider. > > However, we can avoid AI simply by putting everything that isn't > actually in a class or def in separate nodes.
That's what I was trying to describe. Currently: <foo.py> import os def f1(): pass import sys def f2(): print sys.path when rendered as @auto looks like [foo declarations] [f1] [f2] and "import sys" is in the "f2" node We can discuss what is right, but I think this is wrong, "import sys" has no business in a node labeled "f2" "simply by putting everything that isn't actually in a class or def in separate nodes." results in [foo declarations] [f1] [declaration] [f2] So "import sys" can be found. It may not be right, but at least it's not wrong. Thanks, Kent That would be a user > option. I don't think it exists yet ;-) > > Edward > > P.S. I have been making regular improvements in > > scripts.leo#Buttons-->@button create @auto nodes > > as I study programs outside of Leo. One urgent change is to create > @first lines (in the body of the created @auto node) for lines like:: > > #!/usr/bin/env python > # -*- coding: utf-8 -*- > > Another problem appears in the pygments sources. Somehow there is a > warning about @verbatim not being a Leo sentinel. I think that the > warning is erroneous and that @verbatim is a pygments decorator... > > EKR > > -- > You received this message because you are subscribed to the Google Groups > "leo-editor" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/leo-editor?hl=en. > > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.
