Re: solution: clearDirty @ nodes when working with chapters/organizational nodes

2017-03-06 Thread Edward K. Ream
On Mon, Mar 6, 2017 at 10:37 AM, john lunzer  wrote:

> I have commit access, I'll see if I can make some time this week(end).
>

​Great.  Thanks!

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 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.


Re: solution: clearDirty @ nodes when working with chapters/organizational nodes

2017-03-06 Thread john lunzer
I have commit access, I'll see if I can make some time this week(end).

On Monday, March 6, 2017 at 7:29:21 AM UTC-5, Edward K. Ream wrote:
>
> On Sun, Mar 5, 2017 at 2:24 PM, john lunzer  > wrote:
>
> After using these for a few days I think mark-node-clean and 
>> mark-subtree-clean commands would be nice additions to the core.
>>
>
> ​Do you have git commit access?  If so, please issue a PR (Pull Request).
>
> 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 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.


Re: solution: clearDirty @ nodes when working with chapters/organizational nodes

2017-03-06 Thread Edward K. Ream
On Sun, Mar 5, 2017 at 2:24 PM, john lunzer  wrote:

After using these for a few days I think mark-node-clean and
> mark-subtree-clean commands would be nice additions to the core.
>

​Do you have git commit access?  If so, please issue a PR (Pull Request).

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 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.


Re: solution: clearDirty @ nodes when working with chapters/organizational nodes

2017-03-05 Thread john lunzer
After using these for a few days I think mark-node-clean and 
mark-subtree-clean commands would be nice additions to the core.

On Friday, March 3, 2017 at 1:27:00 PM UTC-5, john lunzer wrote:
>
> A design decision was made in Leo that if you alter the heading/body of 
> any parent of an @ node that this node will be marked dirty, ie it 
> will be written to disk when saving the .leo file. After discussion I agree 
> it's the safest option.
>
> However, when using chapters and organizational nodes this can be 
> troublesome because adding @chapter to an organizer node at a high level 
> will mark any files in that subtree dirty. If you have tens, hundreds, or 
> even thousands of @ nodes under a single organizer node it could be 
> painful to have to resave all those files unnecessarily. In my case I 
> access files over a slow VPN and renaming a chapter could result in a 10 
> minute wait while hundreds of files get saved.
>
> I don't have an elegant solution but I do a simple one which I think is a 
> good demonstration for teaching Leo scripting as well. My solution is a 
> button:
>
> Headline:
> @button mark_subtree_clean
>
> Body:
>
> for node in c.p.self_and_subtree():
> node.clearDirty()
> 
> c.redraw()
>
> Hitting the script-button on this node will create a button on the 
> toolbar. 
>
> This small script does a simple thing, but satisfies an important function 
> for me. It took me a few minutes to write (I spent most of that time trying 
> to guess the name of the function which provided the list of all nodes in a 
> subtree) but it saves me time whenever modify the names of my @chapter and 
> organization nodes.
>

-- 
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.


solution: clearDirty @ nodes when working with chapters/organizational nodes

2017-03-03 Thread john lunzer
A design decision was made in Leo that if you alter the heading/body of any 
parent of an @ node that this node will be marked dirty, ie it will 
be written to disk when saving the .leo file. After discussion I agree it's 
the safest option.

However, when using chapters and organizational nodes this can be 
troublesome because adding @chapter to an organizer node at a high level 
will mark any files in that subtree dirty. If you have tens, hundreds, or 
even thousands of @ nodes under a single organizer node it could be 
painful to have to resave all those files unnecessarily. In my case I 
access files over a slow VPN and renaming a chapter could result in a 10 
minute wait while hundreds of files get saved.

I don't have an elegant solution but I do a simple one which I think is a 
good demonstration for teaching Leo scripting as well. My solution is a 
button:

Headline:
@button mark_subtree_clean

Body:

for node in c.p.self_and_subtree():
node.clearDirty()

c.redraw()

Hitting the script-button on this node will create a button on the toolbar. 

This small script does a simple thing, but satisfies an important function 
for me. It took me a few minutes to write (I spent most of that time trying 
to guess the name of the function which provided the list of all nodes in a 
subtree) but it saves me time whenever modify the names of my @chapter and 
organization nodes.

-- 
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.