How To Emit a Clean File From An @file Tree

30 views
Skip to first unread message

tbp1...@gmail.com

unread,
Apr 3, 2021, 6:06:38 PM4/3/21
to leo-editor
I've had a few cases where the external file for an @clean tree went missing.  This causes the file to be empty with no recovery unless there is a backup.  This makes me want to turn all of them into @file trees.  But there are times I want to emit a clean file - no sentinels, etc.

Most recently this came up because I wanted to put some Leo outlines under source control (not on GitHub; on my own computer).  I didn't want to also put the external files in the repo, but they were @clean files and they could end up being the wrong versions if I changed to a different changeset for the outline.

I don't want to put the external files under source control but leave the Leo outline not controlled, because I have a lot of non-file information in the outline.

I know of two ways to save clean files when their parent node is an @file node, both a little clumsy:

1. Temporarily change the tree to an @clean tree, save, then change it back.

2. Put a dummy collection node immediately under the @file node, with the actual file's tree under that.  Clone that node to an @clean node and save.  Then delete the @clean node.

Either way works, but it seems that there should be a better way.  Am I missing something?  If not, this is a feature I'd like.  Something like a new command write-tree-as-clean. There is a question about what the written file should be named so as not to collide with the original, but that doesn't seem hard to solve.
 

Edward K. Ream

unread,
Apr 4, 2021, 8:13:29 AM4/4/21
to leo-editor
On Sat, Apr 3, 2021 at 5:06 PM tbp1...@gmail.com <tbp1...@gmail.com> wrote:

I know of two ways to save clean files when their parent node is an @file node, both a little clumsy:

I think keeping backups is the best way.  Sure, Leo could have a 'write-at-file-as-at-clean' command, but that would be featuritis, imo.

Edward

tbp1...@gmail.com

unread,
Apr 4, 2021, 10:20:35 AM4/4/21
to leo-editor
It was a backup that first got me to realize the problem.  Actually, it was a transfer to a new computer.  All my files used to be on the C: drive and on the new one I used the D: drive.  At the same time, I had thought I didn't need to transfer everything I had,  because some of it was old anyway, or (I thought) could be reproduced from the Leo outlines. 

Quite a while later, I opened up an outline and all the @clean files were blank.  Eventually I realized that I needed to go through all of them and change the paths of the @clean nodes to the D: drive, and try to get the external files I could from the backups I had used to transfer everything.  I didn't succeed for all of them, but at least got most of them back.

My main use case, though, is that I need to produce some of my files clean - because they may have to be read, modified, or compiled by non-Leo users.  It's the source control issue of controlling both the outline and the derived files that I'm mulling over.  Of course, the easiest way is to source-control both, and maybe I'll start doing that.

Edward K. Ream

unread,
Apr 4, 2021, 2:01:14 PM4/4/21
to leo-editor
On Sun, Apr 4, 2021 at 9:20 AM tbp1...@gmail.com <tbp1...@gmail.com> wrote:

Quite a while later, I opened up an outline and all the @clean files were blank.  Eventually I realized that I needed to go through all of them and change the paths of the @clean nodes to the D: drive, and try to get the external files I could from the backups I had used to transfer everything.

Hmm. The .leo file contains copies of all @clean trees--that's the difference between @shadow and @clean. So the data are always there (in the outline), or should be.

Edward
Reply all
Reply to author
Forward
0 new messages