Copy of subtree with loses clones

17 views
Skip to first unread message

mdb

unread,
Jan 4, 2012, 1:03:08 PM1/4/12
to leo-editor
I just noticed that if I copy a node hat contains clones, the pasted
in node has the same subtree node structure but the child nodes are no
longer cloned. I.e. I get an unlinked duplicates of the subtree.

Is this intended? Is there a way to retain the cloning relationship
in the copy?

Why? I want to use the copy as it was with clones as the basis for
creating a new script button.
Now I have to individually bring in the cloned nodes, and delete the
non-cloned nodes

mdb

unread,
Jan 4, 2012, 1:11:27 PM1/4/12
to leo-editor
Nevermind

I found the command

paste-retaining-clones

But I have a related issue.

In a given tree that has nodes with the exact same headline, how can I
replace one node with a clone of the earlier in the outline with the
same headline.

HansBKK

unread,
Jan 4, 2012, 9:47:33 PM1/4/12
to leo-e...@googlegroups.com
On Thursday, January 5, 2012 1:11:27 AM UTC+7, mdb wrote:

In a given tree that has nodes with the exact same headline, how can I replace one node with a clone of the earlier in the outline with the same headline.

Maybe it's me, but I have a hard time understanding what you want to do.

It might be more clear to speak of branches (= a given node and its descendants) rather than nodes "containing clones".

If you clone a node that has descendants, it looks like you've only cloned the one node (i.e. only the "top node" of that branch has the clone indicator in the icon. Functionally, you've cloned the whole branch - all of those nodes are in fact the exact same as their instances in the other locations, and you can confirm this with "goto-next-clone" (which I have mapped to Alt-N, not sure if this is default or not).

If you want a lower-level node to have a different (non-clone) parent, you can either manually create one or copy and regular-paste (not retain-clone) the appropriate node, and then do a clone of the target lower-level node under the new non-clone parent.

If you want a cloned parent to have different children under its different locations/instances, that is not possible in Leo and AFAIK from past threads here will never be possible, as it just doesn't make sense within Leo's data model - the two instances of a cloned node actually represent *the same exact node* including its relationships to its children. (of course if I've interpreted things wrongly I hope those more knowledgeable than me will step in and correct).

Hope this helps - if not, perhaps an example of what you're trying to do would help us understand your question better.


Edward K. Ream

unread,
Jan 5, 2012, 6:54:17 AM1/5/12
to leo-e...@googlegroups.com
On Wed, Jan 4, 2012 at 12:11 PM, mdb <mdbo...@gmail.com> wrote:

> In a given tree that has nodes with the exact same headline, how can I
> replace one node with a clone of the earlier in the outline with the
> same headline.

You don't replace a node by a clone, you create another clone and move
it where you want it.

Edward

mdb

unread,
Jan 5, 2012, 10:00:57 AM1/5/12
to leo-editor
> You don't replace a node by a clone, you create another clone and move
> it where you want it.

Yes, in creating a new outline I would do so, but I am looking to
'fix' an outline that has lost its clones

Example

--CodeSnippets
-- Code1
-- Code2
--Subtree1
-- Code1
-- More1
--Subtree2
-- Code2
-- More2

and I want the Code1 and Code2 nodes to be re-linked to the
CodeSnippet subtree as clones. The outline can have many cases of
this that are awkward to fix by hand (i.e. rather have a script)

I also found that paste-retaining-clones assumes the first node will
be a clone too, not just the children. I was expecting the top node
to be a simple copy-paste and any children that are clones to remain
clones

HansBKK

unread,
Jan 5, 2012, 10:54:31 AM1/5/12
to leo-e...@googlegroups.com
On Thursday, January 5, 2012 10:00:57 PM UTC+7, mdb wrote:
> You don't replace a node by a clone, you create another clone and move it where you want it.

Yes, in creating a new outline I would do so, but I am looking to 'fix' an outline that has lost its clones

Sorry but I don't understand what "an outline losing its clones" might mean.


and I want the Code1 and Code2 nodes to be re-linked to the CodeSnippet subtree as clones.
 
I also don't understand "re-link as clones". If you have two nodes that aren't clones now, there isn't any way to make them be clones. If in your example the nodes with the same names are not actually clones, then just delete the ones you don't want, copy and paste-retaining-clones wherever you like.


I also found that paste-retaining-clones assumes the first node will be a clone too, not just the children.  I was expecting the top node  to be a simple copy-paste and any children that are clones to remain clones
 
Again, your terms aren't clear - are "first node" and "top node" referring to the same thing?

If you go back and look at my previous explanation I tried to make it as clear and simple as possible to understand.

You clone a node to a new location. If that node has descendants, they all "come along for the ride", that whole subtree is actually the same data set in both instances, you can't have it be different in any way in one place from the other as long as they are clones, they simply have two or more parents at the same time.

That's the way Leo's cloning works. If that isn't what you were expecting, then either adjust to the way it works or don't use it.


 
 The outline can have many cases of this that are awkward to fix by hand (i.e. rather have a script)

Sorry I can't help with the script, and don't see how that would help anyway. If you just stop doing it wrong, then it won't need to be fixed any more in future right?

mdb

unread,
Jan 5, 2012, 11:58:48 AM1/5/12
to leo-editor
I will explain in a future posting about the problem of "an outline
losing its clones"

It actually comes from creating and using a DB system to store and
read nodes.

HansBKK

unread,
Jan 5, 2012, 8:47:34 PM1/5/12
to leo-e...@googlegroups.com
On Thursday, January 5, 2012 11:58:48 PM UTC+7, mdb wrote:
I will explain in a future posting about the problem of  "an outline
losing its clones"
 
Aha, “to err is human, but to really foul things up you need an automated process”. 8-)


It actually comes from creating and using a DB system to store and
read nodes.


I'm sure I wouldn't be able to understand it, but as you've seen recently, many people on the list would be interested in more detail on such a beast.

Perhaps Terry's approach of UNLs+scripting would be a possible solution, he apparently doesn't use cloning at all. If the contents of your outlines are automatically generated, then there shouldn't be any problem with their UNL "addresses" getting out of sync - I believe that's the usual reason people don't use them more.

And with sufficient programming foo, maybe a third alternative for your cloning issue would be to create a branch and demonstrate how you think that behavior could be improved, although I believe the fundamental data model is more or less "cast in stone", based on past developer statements here.


Matt Wilkie

unread,
Jan 9, 2012, 12:39:27 AM1/9/12
to leo-e...@googlegroups.com
> Yes, in creating a new outline I would do so, but I am looking to
> 'fix' an outline that has lost its clones
...

> and I want the Code1 and Code2 nodes to be re-linked to the
> CodeSnippet subtree as clones.

I've occasionally wished for a plugin which scanned @file trees for
duplicate content automatically created clones. It would be useful
when studying/slurping code from external projects. Or at least in my
imagination it's useful. ;-)

--
-matt

Reply all
Reply to author
Forward
0 new messages