This is a long post worth reading carefully.
Imo *every* Leo user who does not already use clone-find-all-flattened
should study the tutorial and play with the command until everything makes
sense.
The second part describes a breakthrough that has just changed my life ;-)
===== Part 1: Tutorial
I have been using Leo's clone-find-all-flattened command a lot lately.
This command searches Leo, looking for a pattern, creating clones of all
nodes that match. These clones are organized as children of a single
organizer node. This organizer node becomes the last top-level node of the
outline and is selected when the command completes.
For example, if I search for pattern xyzzy, the command will create a node:
Found (flattened): xyzzy
The children of this node are all nodes matching 'xyzzy' with the find
settings as shown in the Find tab.
Folks, this is close to the holy grail of understanding of a program at the
code level. It tells you *what's so* about your code. Not what the
documentation says, not what you remember, but the *truth*.
===== Part 2: per-file @command nodes
My old work flow when using clone-find-all-flattened was as follows:
- If in leoPy.leo, select the top-level "Code" node, then run the command.
- If in leoPlugins.leo, select the top-level "Plugins" node, then run the
command.
This ensures that everything *of interest* is searched, and nothing else.
The two clone-find-all commands search from the selected node to the end of
the file. This is a feature, not a bug :-)
Aha! Create an @button/@command node that selects the desired node
automatically!
This is a bit tricky due to focus problems. Here is the code for leoPy.leo.
@button cfa-code @key=Ctrl-7 (headline)
'''@button (ekr) clone-find-all-flattened for leoPy.leo.'''
# Find the top-level 'Code' node.
for p2 in c.rootPosition().self_and_siblings():
if p2.h == 'Code':
break
if p2:
# The next two statements are required.
c.selectPosition(p2,enableRedrawFlag=True)
c.bodyWantsFocusNow()
c.k.simulateCommand('clone-find-all-flattened')
else:
g.es_print('not found: Code')
So now my new work flow is simply Ctrl-7 <type search pattern> <return>
I defined a similar @button node for leoPlugins.leo.
*Note*: The two @button nodes use the same Ctrl-7 key binding without any
problem because they are in separate .leo files. It would not be a good
idea to define these buttons in myLeoSettings.leo.
Imo, this is a really big deal. It helps me use one of Leo's most important
commands.
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.