It worked great.

Interestingly, firing the commit found ALL the changes in the entire 
repository, including the Leo files, irrespective of file path.

So I dug a bit more.

Adding the commit to the end of the batch file I use to run Leo also picks 
up ALL changes from ALL folders and commits them and kicks a prompt for a 
commit message.

So no matter where I try to do the commit, I only get one message for all 
of the changes. And there can be quite a lot of them in one session.

Chris

On Saturday, February 10, 2018 at 6:39:25 PM UTC-8, Terry Brown wrote:
>
> I think the key issue is getting the command to execute with the right 
> current directory. I wonder, would c.selectPosition() on the @file node do 
> that? I have a script fragment (not on my phone :) I use for that, but it 
> always seems it should just be p.cd_for_node() or something, and that 
> should consider all relevant @file and @path ancestor nodes. 
> p.cd_for_node() returning a string.
>
> Cheers - Terry 
>
> On February 10, 2018 8:30:37 PM CST, "Edward K. Ream" <edre...@gmail.com 
> <javascript:>> wrote:
>>
>> On Sat, Feb 10, 2018 at 3:09 PM, Chris George <techn...@gmail.com 
>> <javascript:>> wrote:
>>
>> I use Leo to write my weekly column using @clean nodes created using an 
>>> abbreviation. 
>>>
>>  
>>
>>> [I want an @button script to do the following]:
>>>
>>> 1) Save the @clean file to disk.
>>>
>>
>> ​c.save() will do this.
>> ​
>>  
>>
>>> 2) Run a system command in the folder specified in the @clean file path: 
>>>
>> ​​
>>> ​​
>>> ​​
>>> fossil commit -m "<Text from child node here>".
>>>
>>
>> ​See below.
>>  
>>
>>> 3) Clear a child node of the commit message to prepare for next time.
>>>
>>
>> ​See below.​
>>
>>
>> The child node with the commit message shouldn't be written to the @clean 
>>> file.
>>>
>>
>> ​I would put the commit message in a "standard place" known to the 
>> @button script.  Your script can find this node using:
>>
>>     p = g.findNodeAnywhere(c, "fossil commit message")
>>
>> Putting this all together we get:
>>
>> if c.isChanged():
>>     c.save()
>> p = g.findNodeAnywhere(c, "commit node") 
>> message = p.b.replace('"', "'")
>> command = 
>> ​'fossil commit -m "%s"' % message
>>
>> c.controlCommands.executeSubprocess(
>>     event=None,
>>     command=command,
>> )
>>
>> In my prototype, the command was "ls" and all output went to Leo's log 
>> pane and the console.
>>
>> Give it a whirl.  Please report your experiences.
>>
>> Edward 
>>
>>
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to