Losing Clones after restart

62 views
Skip to first unread message

k-hen

unread,
Aug 13, 2020, 1:24:19 PM8/13/20
to leo-editor
Hi,
I'm not sure if this is a bug or if I'm doing something wrong. I've created some cloned nodes, and the icon is correct and they work as I expect, but as soon as I close & reopen leo they become non-cloned (copied) nodes.

I first tried using an in-place clone (ctrl+`) then dragging the clone out, and also tried copy/paste-as-clone but got the same behaviour both times.

Am I missing something?

I'm using Leo installed via pip, 
Leo 6.2.1 final
Python 3.6.3, PyQt version 5.14.2
Windows 10 AMD64 (build 10.0.14393) SP0

Thanks,
Kevin

Thomas Passin

unread,
Aug 13, 2020, 1:38:53 PM8/13/20
to leo-editor
You aren't doing anything wrong, but it shouldn't be happening.  I don't lose my clones that way.  I happen to be on the devel branch but I don't think that's a factor here:

Leo 6.3-devel, devel branch, build 6a92120f1a
2020-06-23 09:38:53 -0500
Python 3.8.2, PyQt version 5.14.2
Windows 10 AMD64 (build 10.0.18362) SP0

Maybe Edward could shed some light here.

k-hen

unread,
Aug 13, 2020, 1:46:13 PM8/13/20
to leo-editor
OK, so I've been able to repeat the behaviour at least.
I created a new outline and cloned a node and it worked fine.

Then for my use case I have an @auto-md clone_test.md with a child node that is being cloned and moved out, and that one is also dropping the clone after restarting leo :-/

k-hen

unread,
Aug 13, 2020, 1:59:51 PM8/13/20
to leo-editor
I saw another post from today about cloning, so I've checked out the current devel branch - and unfortunately it's happening there for me also :-(
The post says something about 'clones' branch, but I don't see one of those.

Félix

unread,
Aug 13, 2020, 4:59:08 PM8/13/20
to leo-editor
That's weird,

For a leo file to change between having 2 positions be clone of each other, to being two distinct nodes, happening to have the same headline and content, requires a non-trivial change...

Would be curious to see if you dont have scripts or plugins enabled that would make changes to your document while its saving it. 

Do you have the bug in a completely new file with only two simple nodes (clones), saving the file, closing the file, then re-opening it?

Or do you have this bug only in a particular Leo file ?
--
Félix

k-hen

unread,
Aug 13, 2020, 5:46:36 PM8/13/20
to leo-editor
Hi Felix,
I am also perplexed. Note that the clones which are not a descendant of the file don't have this behaviour either.

I first encountered this in my large document using the pip version (6.2).
I was able to reproduce this however using both a new/fresh/extremely small .leo file,
I was also encountered this after installing/using the git version (6.3-devel).

I don't have any custom scripts or plugins, only the defaults.


Kevin

Thomas Passin

unread,
Aug 13, 2020, 6:28:00 PM8/13/20
to leo-editor
Is it correct that you only are seeing this behavior on (a?) auto-md file?

percepti...@gmail.com

unread,
Aug 13, 2020, 6:35:17 PM8/13/20
to leo-e...@googlegroups.com
I've been thinking about this a bit more, and I'm thinking this is probably expected and I just wasn't thinking about it properly.
Since this is an *auto* node, perhaps it's clearing & reloading the descdendant nodes of my file on the load of Leo.
So the clone is there originally, then it deletes the file child node to re-import (making the non-file node a non-clone), 
then recreates a new child node with the same name as a copy. 

This at least makes sense to me now, I suppose I'll just have to restructure my outline because I still want to be able to sync with other users using pure markdown and  not using Leo.

Kevin
--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/oKGhRhUVTXA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/f5e36dce-6a7a-407c-b356-1fe40c7f3e91n%40googlegroups.com.

Thomas Passin

unread,
Aug 13, 2020, 6:38:09 PM8/13/20
to leo-editor
Aha! I duplicated this behavior.  I got the same loss of clone-hood in an @auto-md tree.  I did not get it in an @file tree.  When I cloned a node in an @auto-md tree and dragged it out of the tree, it still lost its clone status whe I closed and reloaded the file.

percepti...@gmail.com

unread,
Aug 13, 2020, 7:31:02 PM8/13/20
to leo-e...@googlegroups.com
Well, Glad I'm in good company :-)

I'm thinking the workaround is to use a the full path for every @auto headline, rather than nesting @path nodes?.
Is there perhaps a way to do expansion on the filename within a headline or something so I don't need to repeat it all?

It doesn't seem wise to clone the @auto-md, but maybe that works. 

If there's a directive or expansion or something I can put in the @auto node body then that could make it a lot cleaner.
Note that there are hundreds if not thousands of files and the paths are subject to change.


What I'd like to have:

* MyOutline
** MyFolder
*** Thing1
**** Thing1 Docs
***** @auto-md Thing1 .md
**** Thing1 Code
**** Thing1 Notes
** Files
*** Docs
**** @path ..\docs
***** @path things
****** @auto-md Thing1.md (clone)


Workaround?

* MyOutline
** MyFolder
*** Thing1
**** Thing1 Docs
***** @auto-md ..\docs\things\Thing1 .md
**** Thing1 Code
**** Thing1 Notes

--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/oKGhRhUVTXA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.

Thomas Passin

unread,
Aug 13, 2020, 8:01:44 PM8/13/20
to leo-editor
Why is it that you want to use auto-md trees? You could consider ReStructured text, for example.


On Thursday, August 13, 2020 at 7:31:02 PM UTC-4, k-hen wrote:
Well, Glad I'm in good company :-)

I'm thinking the workaround is to use a the full path for every @auto headline, rather than nesting @path nodes?.
Is there perhaps a way to do expansion on the filename within a headline or something so I don't need to repeat it all?

It doesn't seem wise to clone the @auto-md, but maybe that works. 

If there's a directive or expansion or something I can put in the @auto node body then that could make it a lot cleaner.
Note that there are hundreds if not thousands of files and the paths are subject to change.


What I'd like to have:

* MyOutline
** MyFolder
*** Thing1
**** Thing1 Docs
***** @auto-md Thing1 .md
**** Thing1 Code
**** Thing1 Notes
** Files
[snip]

Thomas Passin

unread,
Aug 13, 2020, 11:29:55 PM8/13/20
to leo-editor


On Thursday, August 13, 2020 at 7:31:02 PM UTC-4, k-hen wrote:
[snip]

Would you file a bug issue on this?  The issue URL is

Edward K. Ream

unread,
Aug 14, 2020, 8:10:45 AM8/14/20
to leo-editor
My apologies for not jumping in yesterday.

This is not a bug.  Leo has substantial machinery for recreating clones in all kinds of @auto nodes. To activate this machinery put the following underneath your @settings tree in myLeoSettings.leo:

@bool create-at-persistence-nodes-automatically = True

Here is the comment in the body text of this node:

With @clean and @file, Leo can store persistent data in nodes. This
information consists of the node’s gnx (Global Node Index) and the node’s
uA, (User Attributes).

The gnx gives each node a unique, immutable identity. Gnx’s make clones
possible. The uA allows scripts and plugins to associate arbitrarily much
additional data with each node.

By default, Leo’s importers preserve neither gnx’s nor uA’s. This makes
imported @auto trees second class citizens. To remedy this, if an outline
contains an @persistence node, Leo will save data in the @persistence tree
that allows Leo to recover gnx’s and uA’s when re-reading @auto files
later. This allows clone links and uA’s to persist.

This is an optional feature. The stored data is akin to bookmarks. The data
can “break” (become inaccessible) if the structure (including
class/method/function names) changes.

HTH.

Edward

percepti...@gmail.com

unread,
Aug 14, 2020, 10:17:20 AM8/14/20
to leo-e...@googlegroups.com
Thank you kindly for your reply. I've enabled this feature and it seems very promising, but I think I might need a slightly different behaviour.
I'll take a minute to explain the use case.


In our git project we have a docs directory which is a simple collection of markdown files. 
This works great for the team because it's so simple and because many, many editors support this easily.
MkDocs [https://www.mkdocs.org/] is also an amazing project that with the serve command,
will allow you to view and navigate these files easily and convert to many client-friendly formats for basic publication. 

Obviously when I git pull, I'd like for Leo to refresh the content of those files, then I can edit them in Leo and save the changes back. 
The markdown docs are *trees* themselves however and the cloning behaviour seems to be occurring at the bottom/leaf level instead of the root.
This is likely the desired behaviour for _code_ because it would be at the function/method level, 
but the commonality with markdown docs is a common *root* node for each document,
(although there is the added snag of a possible front-matter section preceding this, but that could be a fixed section as its universal).

In a perfect world, I could specify a sync directory in Leo and it would automatically import all of the files in those directories,
then I could clone them into my own custom outline which is organized differently and with code and notes and statuses and such that don't belong in the docs.


Does this seem feasible somehow (within reason)?   :-)
--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/oKGhRhUVTXA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.

Thomas Passin

unread,
Aug 14, 2020, 10:49:57 AM8/14/20
to leo-editor


On Friday, August 14, 2020 at 10:17:20 AM UTC-4, k-hen wrote:
Thank you kindly for your reply. I've enabled this feature and it seems very promising, but I think I might need a slightly different behaviour.
I'll take a minute to explain the use case.

[snip]
This is likely the desired behaviour for _code_ because it would be at the function/method level,
[snip]

I know this is not the main thrust of your message, but I just want to point out something here that bears on using Leo;  in fact it's one of the great things about Leo when compared to other editors that have a tree-view pane.  You are not limited to having a function or method in a single node.  I often split parts of a function or method across several child nodes, and Leo's code base does the same.  This lets you keep a useful block of code on one screen.  The common (non-Leo) advice is to split a function up into smaller function calls if it's too long, but that can be annoying and even confusing because you have to keep too many functions and their parameters in mind at once.  Leo lets you break out from that rigid mold, though of course you can still do so if you want.

Edward K. Ream

unread,
Aug 14, 2020, 11:10:46 AM8/14/20
to leo-editor
On Fri, Aug 14, 2020 at 9:17 AM <percepti...@gmail.com> wrote:

In a perfect world, I could specify a sync directory in Leo and it would automatically import all of the files in those directories,

Please have a look at the active_path and at_folder plugins.

Edward

percepti...@gmail.com

unread,
Aug 14, 2020, 11:22:50 AM8/14/20
to leo-e...@googlegroups.com
Interesting, that's a good point, thanks for the info.
--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/oKGhRhUVTXA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages