Leo Interrupt

76 views
Skip to first unread message

k-hen

unread,
Aug 20, 2020, 2:06:45 PM8/20/20
to leo-editor
Hi,
Just wondering - Is there perhaps a way to interrupt Leo without fully killing it?
I have a large outline that is writing to a file I'm working on, a few hundred nodes now but will extend into thousands - and if/when I make an error it loops through the Orphan/Parent errors for every descendant and it can take 20-30 minutes to get through them all.

I'd like to interrupt what it's doing without just killing all of Leo, in which case I sometimes lose changes (I'm using the Sqlite DB backend). Hopefully there's a better way to handle this and/or get Leo to stop processing after a certain number of errors.



Thomas Passin

unread,
Aug 20, 2020, 3:26:24 PM8/20/20
to leo-editor
Try to find a way to only add a small number at a time, then save.  Eventually you should learn how to avoid the errors, and then you won't have the problem.

Edward K. Ream

unread,
Aug 20, 2020, 6:57:11 PM8/20/20
to leo-editor
On Thu, Aug 20, 2020 at 2:26 PM Thomas Passin <tbp1...@gmail.com> wrote:
Try to find a way to only add a small number at a time, then save.  Eventually you should learn how to avoid the errors, and then you won't have the problem.

You can even specify a single file, rather than a directory, in the recursive import script I gave earlier.

Edward

Edward K. Ream

unread,
Aug 20, 2020, 7:00:05 PM8/20/20
to leo-editor
On Thu, Aug 20, 2020 at 1:06 PM k-hen <percepti...@gmail.com> wrote:
Hi,
Just wondering - Is there perhaps a way to interrupt Leo without fully killing it?

There isn't, and it's not likely ever to happen.

In general, you want a work flow that is impervious to killing Leo from the console. Using git to protect valuable original sources is what I recommend.  `git checkout .` will undo any horrors :-)

Edward

k-hen

unread,
Aug 21, 2020, 10:14:43 AM8/21/20
to leo-editor
Yes, absolutely, I'm a huge proponent of Git and it's toolchain :-)
That said I want my personal comments and notes and settings *outside* of git and not checked in as well.
So I need both regular backups/protection for Leo in _addition_ to the Git repo which is synced with other devs.

Edward K. Ream

unread,
Aug 21, 2020, 10:22:24 AM8/21/20
to leo-editor
On Fri, Aug 21, 2020 at 9:14 AM k-hen <percepti...@gmail.com> wrote:
Yes, absolutely, I'm a huge proponent of Git and it's toolchain :-)
That said I want my personal comments and notes and settings *outside* of git and not checked in as well.
So I need both regular backups/protection for Leo in _addition_ to the Git repo which is synced with other devs.

I'm not sure what happened. However, Leo's perfect import checks are strong. If they fail, the importers will add @ignore directives, preventing accidental changes to your files.

I should add that Leo's importers are the foundation for both @auto and @clean, as well as c.recursiveImport.

Edward

vitalije

unread,
Aug 21, 2020, 1:24:43 PM8/21/20
to leo-editor


On Friday, August 21, 2020 at 4:14:43 PM UTC+2, k-hen wrote:
Yes, absolutely, I'm a huge proponent of Git and it's toolchain :-)
That said I want my personal comments and notes and settings *outside* of git and not checked in as well.
So I need both regular backups/protection for Leo in _addition_ to the Git repo which is synced with other devs.


I am not sure this is relevant, but there is a history_tracer plug-in which takes snapshots of your Leo files after each change. That is something like making git commit after each edit. You need to have leo-ver-serv program running and your Leo documents must be on the list of files that leo-ver-serv should keep an eye on.

By the way, I would also like that we could interrupt Leo without killing it. On several occasions I missed that functionality. I've added support for interrupting the execute-script command in Leo, and it wouldn't be so hard to support many other commands. I don't have the time to do it myself right now, but I guess it would be sufficient to add try/except KeyboardInterrupt pair around some global method that executes commands. This might not cover all commands, but it certainly would cover a lot of them. Edward was recently refactoring key handling code and I believe there is a method something like a main command handler there.

Vitalije

k-hen

unread,
Aug 21, 2020, 2:53:29 PM8/21/20
to leo-editor
Excellent, I'll check it out - thanks! - do you happen to know if that history_tracer works with the sqlite/db back-end?
Re: interrupt, that's great news too - in addition to just Leo functions, if/when I get database queries working, being able to cancel the command is a relatively critical use case there too :-)

Kevin

vitalije

unread,
Aug 21, 2020, 3:16:06 PM8/21/20
to leo-editor
leo-ver-serv will store all the history of Leo files in the sqlite3 database files named after the original Leo files, just with added '.history'. If for example you edit workbook.leo file, leo-ver-serv will store changes to workbook.leo.history in the same folder.

Vitalije

k-hen

unread,
Aug 21, 2020, 4:32:31 PM8/21/20
to leo-editor
Very cool - sounds like something I'll be using soon then - thanks!
Reply all
Reply to author
Forward
0 new messages