Thanks - I'm familiar (though rusty) with the mechanism of @commands in 
myLeoSettings.leo etc.

My first experiment following Edward's hint used just

    c.executeMinibufferCommand('insert-headline-time')

(I didn't know about 'c.k.simulatecommand()')

and clearly I can work on the exact behaviour here.

More generally, I was intending to flag the seeming corner-case in 
behaviour. I will do some experimenting...

Cheers, J^n



On Thursday, April 22, 2021 at 4:10:27 PM UTC+1 [email protected] wrote:

> Here is the simplest thing that could work, I think.  Try this out in your 
> workbook or some equivalent place to make sure it does what you want.
>
> Create a new node, named perhaps "Insert Time in Head". Put the following 
> into the body:
>
> p.h = ''
> c.k.simulateCommand('insert-headline-time')
>
> (There may be other ways to activate a Leo command, but this is the one I 
> know about).
> Select this node and press the *script-button* key to make a button for 
> this command.  Now create another new node, and press your new button.  The 
> new node's headline should change to the date, e.g., "4/22".
>
> After you play with this and decide it does what you want, you can move 
> the command over to *MyLeoSettings.leo* so that it will be available to 
> all outlines.  If you like it as a button, copy the node to the 
> *@settings/@buttons* subtree, and change the node headline to *@button 
> Insert Time in Head*.  
>
> If you want a command but not a button, put its node into the 
> *@settings/@commands* subtree, and change the node headline to read *@command 
> Insert Time in Head*. 
>
> If you'd like this command to have a keyboard shortcut, add one to the 
> node's headline:  *@command Insert Time in Head @key=Alt-F9*.
>
> After you restart Leo, your new command will be available to every outline.
>
>
> On Thursday, April 22, 2021 at 7:04:24 AM UTC-4 Edward K. Ream wrote:
>
>> On Thu, Apr 22, 2021 at 5:27 AM jkn <[email protected]> wrote:
>>
>> Any chance of addressing this? As I say, it's only a small scratch...
>>
>>
>> It should be possible to create an @command node that would replace the 
>> headline with the date.
>>
>> Edward
>>
>

-- 
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/ab5cf03c-ff64-4d2c-b0d6-30c3e16d1622n%40googlegroups.com.

Reply via email to