This is blue sky thinking. Nothing is certain.

The goal: *turn Atom into Leo in the simplest way possible*.

The simplest thing that could possibly work might be to loosely base the 
leo plugin on the existing hydrogen plugin 
<https://github.com/nteract/hydrogen>.

Please enable the hydrogen plugin to Atom and follow along this simple 
example.

1. Create a new .py file and save it. Add this line:

import os

Select this line and hit Ctrl-enter (hydrogen:run). A check mark appears 
after the line.

2. Add this line, select it and hit Ctrl-enter again.

os

You should get something like this:

os |<module 'os' from 'C:\\Anaconda3\\lib\\os.py'>|

The vertical bars denote a faint box.. This indicates that "os" is part of 
a persistent namespace!

Behind the scenes, hydrogen sends the expression "os" to a "kernel".  
Details fuzzy.

Just this may be enough to form the basis of Leo support in atom!  
Something like this.  Details *very* fuzzy:

- Javascript code (in atom) will draw Leo outlines.  This code will be 
based on core (atom) tree code.

- Opening a .leo file (in atom) will init *python state data* in the python 
kernel. *Python code* in the kernel will load the .leo file and create a 
representation (a tree of vnodes, or an sqlite db) of the outline *in the 
kernel namespace*. The python code will pass a representation (as json or 
cson) of the entire outline back to Leo's js plugin code.  This will only 
happen once, when opening the outline.

- Leos' javascript code (in atom) will update the screen when inserting, 
deleting, moving, changing and cloning nodes.  So the js code acts pretty 
much like gui code. The js code must (probably) also update the python 
representation in the kernel namespace for the outline.

- The execute-script command (in atom) will send the to-be-executed script 
to the kernel.  The kernel, using the state data for the outline, will run 
the script and return the value of the script, and any side effects of the 
script, again as json/cson.  Using this returned value, the gui code will 
insert, delete, move, change and cloned nodes on the screen.

*Summary*

Leo's plugin (javascript) acts like Leo's gui code. The plugin will also 
handle some (most?) of Leo's commands.  Commands requiring extensive python 
code will be passed to the python kernel (per-outline namespace).  Results 
passed back to Leo's js plugin code then update the screen and Leo's js 
data structures.

An experienced atom programmer might be able to do this in a few days.  It 
will take me much longer—perhaps weeks or longer. That doesn't bother me. I 
will learn a lot along the way, including a lot about js/coffeescript 
tooling.

Edward

P.S.  Yesterday I learned that new js standards do *not* invalidate 
coffeescript (cs).  Instead, cs2 now generates "new" javascript directly.  
cs2 will break some cs1 code, but that's not a big deal and it doesn't 
affect a possible Leo plugin for atom.

Amazingly (to me) lots of js programmers seem to hate coffeescript.  But 
that's not my problem, since atom can be programmed in either js or cs2.

EKR

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

Reply via email to