Hacking Heaven - Leo+XEmacs Integrated

Aum spam at al-queda.org
Tue Jan 28 18:27:53 EST 2003


On Tue, 28 Jan 2003 16:39:46 -0500, Jack Diederich wrote:

> On Tue, Jan 28, 2003 at 09:18:25PM +1300, Aum wrote:
>> Some months ago, the 'metastructural' editor 'Leo' (http://leo.sf.net) got 
>> covered on Slashdot. Seeing the power it offered to boost my productivity 
>> with code editing, I immediately downloaded it.
>> 
> 
> I looked at the leo site, and a bunch of Literate Programming sites
> and the intros all sucked.  hard.  Couldn't be more vague.


The concept of Literate Programming can feel very vague if one is
accustomed to 1-D and 2-D editors.


> Do you have a favorite one-pager intro?


A picture tells a thousand words. Check out a screenshot at:
http://www.freenet.org.nz/downloads/leo-screenshot.gif
This shows a Leo window on the left, and XEmacs on the right.

Whenever you click on a node in the Leo window, that piece of code gets
opened as a buffer in XEmacs. When you save the buffer in XEmacs, Leo
detects this and saves it out to the source file.

Leo gives you an abstract view of your code. Also, something the
screenshot doesn't show, is that it lets you create different 'views', so
you can represent your code in different paradigms.

It's saving me buckets of time and sweat.


> I like the concept but it is very 
> ill-defined.  Even a couple paragraphs about how you use/how it changed your 
> cycle it would be nice.


Traditionally, physical files and directories are the mechanisms for
grouping pieces of code. With Leo, you create your own grouping paradigms,
and it matters very little which *physical* files you code gets stored
into. You're free to follow the traditional grouping, and put stuff into
files and directories according to logical function, but you can stray
from this at any time.

One of Leo's most powerful features is 'cloning' - the ability to create a
cloned copy of a node on its tree. This means that the same *physical*
node appears on the tree in 2 or more *logical* places.

One great use of cloning is when you have repeated code - the same bunch
of statements that you want to appear in multiple places in the same or
different files. In languages like C, you'd use the clunky '#include'
mechanism. But with Leo, you can clone nodes all over the place, nodes
that each have zero or more child nodes.

Another use of cloning is doco - by creating an abstract view, separate to
the physical view, you can create an outline that walks people through
your code very quickly and intuitively.

I think the best way to comprehend of the 3-D (n-D?) freedom Leo offers is
to download/install it and try it out. It has this nice 'import' feature,
where it can read in existing source files in many languages (python,
perl, C/C++, PHP, etc), and slice 'em up into their component parts -
classes, functions, struct defs etc. On the Leo node pane, these files are
automatically shown as trees of components.

It's saved me a lot of time, because it's freed me from the menial
distraction of worrying about what files contain what pieces, and it
empowers me to see the 'forest' *and* the 'trees' at all times.


> Obviously it would be the view of a convert, but I'd like to hear about
> how it works in practice.  Unless a project has everyone using the same
> tool, is it hard to publish or hard to incorporate patches from people
> that aren't using it?


The recent 'open-with' feature in Leo allows team participation with code
editing.

And if people refuse to use Leo, just ask them to leave Leo's source code
markups intact. Leo will then be able to read in the changed raw source
files and update its own tree representation automatically.


> I'll-try-anything-that-makes-me-more-productive-ly,


Within a couple of hours, Leo will definitely do that :)

Cheers
A





More information about the Python-list mailing list