You are correct, the @others is just a node body directive and doesn't dictate where or how a file will be stored, only the structure of the file.
If you're just personal commands which you don't intend on sharing then you'll likely just want to keep them in your myLeoSettings.leo file and that command will be available with every .leo you ope. Or if they're very specific commands directly related to a project you're working on then you can put them in a specific .leo file and the command will only be available to that .leo file. Unless you have a very specific need to keep these files externally I wouldn't force the issue. If you do have a need to access the files externally then it's a probably a good idea to write you commands in a plugin and register them as commands using the @g.command decorator. It's not a complicated as it sounds. The leoPluginsRef.py file has a good smattering of plugins of different complexities. I believe you just need a very basic init function: def init (): '''Return True if the plugin has loaded successfully.''' g.plugin_signon(__name__) return True And then you can create a function with the @g.command decorator preceding it and that will register the command for use. Hopefully I'm not missing anything. On Monday, February 8, 2016 at 3:04:57 PM UTC-5, jkn wrote: > > Hi John > > On Monday, February 8, 2016 at 2:07:33 PM UTC, john lunzer wrote: >> >> I'm a little confused by your request and perhaps Jacob answered it but I >> feel like I heard a much simpler question. >> >> You can use the @others directive in the body of you @command node. This >> is the same as what you would do in an @<file> node. >> >> I have abused this horribly to my own ends to write a complex refactoring >> plugin as an @command that has over 70 child nodes. I did this before I >> fully understood plugins. >> >> On Friday, February 5, 2016 at 4:20:23 PM UTC-5, jkn wrote: >>> >>> I'm getting around to writing some useful @command scripts today, and I >>> wondered about what is probably a faq: >>> >>> does the whole body of an @command script have to live within a single >>> node? I have several commands which have common functionality, >>> and I want to be able to do the equivalent of 'import <node>'. >>> >>> The Scripting tutorial page tantalises with: "*you can create complex >>> scripts from a node and its descendants*", but I think this >>> is referring to scripts written to external files. >>> >>> Apologies if there is (as I suspect) a simple explanation of this >>> somewhere. >>> >>> Thanks >>> Jon N >>> >> > But doesn't @others work (with @file) to create a separate (python) file > from the .leo file that I am working with? That's what I meant when I said > "...referring to scripts written to external files". I want to avoid that - > I think... > > I confess I have done basically nothing with external files in leo, > amusing when I originally got here via 'literate programming', tangle/weave > etc., which I think is also where Edward started off. > > Apologies if my assumptions don't match what you are describing [thinks > ... really must try to use @file sometime, in any case]. > > > Regards > Jon > -- 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 https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
