On Tue, Oct 2, 2012 at 12:44 PM, F.S. <[email protected]> wrote:
> Good point. In Emacs I can dump comma (or some other delimiter) separated
> data into a buffer and run org-table on it and viola I get the data all
> nicely tabulated. With Leo scripting this should be doable too.
Yes.
> However in
> Emacs it is easy to attach arbitrary action to any text through buttons that
> can be placed anywhere in any buffer.
That's what Leo's script buttons do. A script button script could act
on the entire file (as in Emacs) or on the presently selected node
(typical) or on a found set of nodes, say all the nodes with
@something in the headline.
So if you *only* consider nodes to be equivalent to emacs buffers,
@button scripts are just as powerful as emacs buttons. But in
addition, @button scripts have full, easy access to all aspects of
Leo's outline structure. Thus, Leo scripts can easily do things that
would be extremely laborious in emacs.
> I have large data sets that take time to load and process into Python memory.
> Somehow it feels hazardous to load them into the same process as my editor :-)
Your intuition is probably faulty. Loading large data into Leo should be safe.
> With Emacs, I can easily run the inferior Python interactively through the
> comint where I get the Python prompt. With Leo I can simulate this by
> writing code in a script node and redirect the output to the log pane.
Yes, you could do that. Or you redirect output to any node.
> With Emacs I can also write/modify code in any source buffer and test the
> code out immediately by incrementally sending them to the interpreter.
> (through eval string, eval region or eval function/class def). This is
> tremendously effective for exploratory coding.* Can I do something along the
> same line in Leo?
Of course you can! That's what Leo's Ctrl-B (execute-script) does.
But unlike flat editors, Ctrl-B composes the script from the node and
all it's descendants if you use @others or section references. For
example:
<< imports >>
@others
sc = ScriptController(c)
sc.run()
The ScriptController class will be defined in child node of this node.
This class could be complex, defined in many different nodes.
And to repeat, all Leo scripts have full access to all data in all Leo nodes.
> * Yes that does mess up the namespace that may have to be taken care of
> later but it is well worth the effort.
Executing scripts is safe. For details, look at the code in c.executeScript.
> I also plan to, with Leo's help, keep
> source codes in as few files as possible. I prefer Lisp style large top
> level symbol table over arbitrary modules esp as one can already wrap things
> in a class if necessary.
No problem. Leo's source files are very large compared to typical
practice for much the same reason.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.