Re: Recommended place to store common functions?

2018-10-29 Thread Edward K. Ream
On Mon, Oct 29, 2018 at 10:19 AM Sapphira Armageddos wrote:

Hello Sapphira.  Welcome aboard.

what's considered best coding practice for storing Leo specific python code
> that I'd reuse elsewhere?
>

Good question.  There are several ways to reuse code:

1. You can define abbreviations.  This lets you insert code, but not
execute it.

Abbreviations can expand to trees, so you aren't limited.  You would
typically store them in myLeoSettings.leo, (open with the my-leo-settings
command) the one of these nodes:

@data global-abbreviations
@outline-data tree-abbreviations

See leoSettings.leo for details.

2. Any @button or @command node defined in myLeoSettings.leo will be
available in all open outlines:

- @b shows the list of @button commands.
- @c shows the list of @command commands.

3. You can dump code into, say, scripts.leo.  Open with leo-scripts-leo.

4. Or define @command open-my-scripts this way:

g.openWithFileName('')

HTH.

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.


Recommended place to store common functions?

2018-10-29 Thread Sapphira Armageddos
Hi everyone!

Been using Leo for a while and I love it. One thing that alludes me is - 
what's considered best coding practice for storing Leo specific python code 
that I'd reuse elsewhere? For instance, sometimes I have outline specific 
commands that make call the undoer to make undoing easier. However, I also 
have some commands at a global level stored in myLeoSettings.leo that also 
call this undoer function. Since the code is specific to Leo, but sometimes 
shared across projects, where should I store the helper functions to keep 
it reusable across my outlines?

Thanks,
Sapphira Armageddos

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