Perhaps you can guide me through a design decision then. I'm still hard at 
work on my quick-replace plugin. It's coming along swimmingly and I use it 
everyday, getting more useful as I continue to add features. 

I've added in a feature to search from a list of saved search/replace 
patterns to quickly apply that pattern (great for individual beautifying 
search/replace patterns or common tasks like removing non-inline comment 
lines). I'm storing these "description", "search", "replace" groups in an 
@settings @data node with special character patterns to help me parse the 
body.

This is working but what I'd really like to do is allow the user to save 
their own patterns through the UI of my plugin. Since I'm using Leo I 
thought I'd stay within the Leo paradigm, however it seems that an 
@settings @data node may not be appropriate.

What do you think the most Leonine method would be to store these patterns 
for both reading and writing? Would it make sense to store these in an 
external file (xml maybe) and then just have an @settings node pointing to 
that file location? 

On Monday, July 20, 2015 at 8:17:09 AM UTC-4, Edward K. Ream wrote:
>
> On Fri, Jul 17, 2015 at 11:21 AM, john lunzer <[email protected] 
> <javascript:>> wrote:
>
>> I see there is a getData method for reading from @settings @data nodes. I 
>> see a suspicious lack of a setData method in the same module. I'm guessing 
>> this is by design but is there any way to save to @settings through 
>> scripting?
>>
>
> ​Heh.  In effect, you have exposed a smallish security hole in Leo. 
>
> There are settings which really should not be changed except by the user's 
> conscious decision.  You can run leoTest.leo to see a warning about a 
> security hole.  So if you could get a use to run a script to change the 
> settings, you would undermine Leo's startup security. Otoh, if you can get 
> the user to unknowingly run a Leo script, it could easily erase the entire 
> hard drive without further ado.
>
> In any case, there is an easy answer to your question.  Write a script to 
> search for the desired setting in the @setting tree, creating it if need 
> be.  This is simply a search for the desired p.h.  Then set p.h or p.b as 
> appropriate.
>
> Having said that, I see little or no reason for such a script.
>
> 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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to