On Saturday, February 29, 2020 at 9:59:33 AM UTC-5, andyjim wrote:
>
> [snip]
> On Saturday, February 29, 2020 at 12:28:27 AM UTC-5, Thomas Passin wrote:
> I think that's the solution for my use case. If, for example, as in The
> Archive, Command-N (no matter where I am at the moment) creates a new
> zettel, in the 'temporary notes' node, plants the id, and the 'created'
> timestamp, and shifts focus to the body, then I have a distraction-free way
> to immediately capture a new thought bubble. This will cleanly initiate the
> process of thought capture. I might want a 'back button' to take me back
> where I was before this event, but that's another matter for another day.
>
Here is a modified version of the "Insert-Zettel" command. It creates a
new node. inserts the id and creation date, and puts the cursor in the node
under them ready to type. It doesn't locate the new node in a "temporary"
part of the outline - that could be added later.
"""Insert a node with id and creation timestamp strings"""
undoType = 'zettel-insert-node'
c.k.simulateCommand('insert-node')
w = c.frame.body.wrapper
oldSel = w.getSelectionRange()
w.deleteTextSelection()
s = ':id: ' + p.gnx
id_label = f':id: {p.gnx}\n'
time_string = ':created: ' + c.getTime(body=True) + '\n'
i = w.getInsertPoint()
w.insert(i, f'{id_label}{time_string}')
c.bodyWantsFocusNow()
c.frame.body.onBodyChanged(undoType, oldSel=oldSel)
To use this command, delete the old @setting node for inserting the id, and
then create a new @setting node with the headline
@command zettel-insert-node @key=Alt+F8
Paste the code above into this new node. The new node has be a child of an
@settings node in either your MyLeoSettings.leo file or your ZK leo file,
so move it as needed. Then reload the settings. The hot-key will be
ALT-F8.
If you decide you'd rather leave the cursor in the node's headline instead,
change the next to last line so it reads like this:
#c.bodyWantsFocusNow()
This will turn the line into a comment and cause it not to be executed.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/f2b81e9c-b6e9-4dff-b042-afac57eeacb7%40googlegroups.com.