As of rev eda7689, Leo sports a useful new generator.  Here is the 
signature and docstring:

def nearest_roots(self, predicate=None):
    '''
    A generator yielding all the root positions "near" p1 = self that
    satisfy the given predicate. p.isAnyAtFileNode is the default
    predicate.
    
    This pattern occurs many times in Leo's code. It's time to make it
    official. It allows user to execute commands from:
    - Anywhere *within* a tree, or
    - On all trees *within* a tree.
    
    The search first proceeds up the p's tree. If a root is found, this
    generator yields just that root.
    
    Otherwise, the generator yields all nodes in p.subtree() that satisfy
    the predicate. Once a root is found, the generator skips its subtree.
    '''

This pattern does indeed occur surprisingly often in throughout Leo.  I'll 
post an example in another thread.

Edward

-- 
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 [email protected].
To post to this group, send email to [email protected].
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