Once again, surprised by existing capability of Leo.

Re: 2015: somehow digest and present in a coherent way, all the
stuff that's already available, which only a few are taking advantage of.

I think a floating window like stickynotes would be good for 'live' coding.
I often use 'add-editor' to be able to see the code I'm writing a test for ...
so if a render pane is added, I've only got 1/3 editor width.

This discussion has made me realize I should switch to
stickynotes for the alternate view instead of add-editor ...

On Sat, Jan 31, 2015 at 10:36 AM, 'Terry Brown' via leo-editor
<[email protected]> wrote:
> On Sat, 31 Jan 2015 07:37:01 -0600
> "Edward K. Ream" <[email protected]> wrote:
>
>> In any case, new code will be required to capture and render the
>> output of execute-script, regardless of where the rendering winds up.
>
> Unless you just use vs-eval :-)
>
> It executes the selected text, shows the output in the log pane, then
> selects the next line.  So for this code:
>
>     a = 2
>     b = 3
>     c_ = 4
>     print c_
>     print c_+2
>     d = a+b
>
> if you select-all vs-eval the log pane shows
>
> 4
> 6
> 5
>
> one output for each print and one output for the last assignment.
>
> If instead of select all you just place the cursor at the start of the
> first line and repeatedly vs-eval, the output in the log pane is
>
> 2, 3, 4, 4, 6, 5 (on separate lines)
>
> vs-eval doesn't understand multi line code one line at a time, you have
> to select a valid block (the whole def or for) and execute it all at
> once.
>
> And at any point you can insert the last result into the body with
> vs-last or vs-last-pretty.  So I can type 52*40*12.5, select it,
> ls-eval (bound to a handy key of course) and ls-last to put the answer
> in.
>
> Or there's the livecode plugin which is more interactive, and currently
> has a dependency on the `meta` module.  I see live code as more of a
> toy / teaching aid, although I suppose it could be useful for
> developing fiddly things, like:
>
>     import re
>     x = re.compile('[123]')
>     x.match("543")
>     x.match("354")
>
> so as you edit the regexp the match results are updated in real time
> allowing you to know when you have the effect you want.  That's how
> everyone writes regexp, right, just keep changing it randomly until it
> works? :-)
>
> So yes, Leo can have more ways of executing code, but it already has
> four:
>
>   - execute-script / @button, which can bind results anywhere it wants,
>     including p.insertAsLastChild().b = repr(result)
>
>     Maybe this last would be better as
>
>     def log(self, result):
>         nd = self.insertAsLastChild()
>         nd.h = time.strftime('%H:%M:%S %b %d %Y, %a')
>         nd.b = repr(result)
>     ...
>     p.log(result)
>
>   - vs-eval
>
>   - the rest of the valuespace plugin machinery, which is quite
>     abstract but I suspect quite powerful in terms of its whole-tree
>     integration
>
>   - live code
>
> Cheers -Terry
>
> --
> 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.

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