On Fri, Dec 6, 2013 at 3:02 PM, Dave Loyall <[email protected]>wrote:
>
> Regarding the output of org-mode's exporters being similar to @nosent
> files, well, that's a feature.
>
@nosent does not suffice for programming.
If it did, Leo would simply use @nosent instead of @file, @shadow, @edit,
@auto and the rest.
> For emitting source code, you'd use org-babel. That framework allows you
> to write snippets of source code in arbitrary programming languages into an
> org file and then execute each snippet individually, saving the output to
> the org file, or to external files. You can also write all the snippets
> into a single source file... Some crazy folk use snippets to write OTHER
> snippets or whole org files, causing the snake to eat its own tail. (Would
> you describe this as Leonine?)
>
We can both agree that scripts/programs can do anything.
The question is, how easy and natural is it to do so?
org-babel is impossibly clumsy for writing applications. Moreover, it is
almost completely clueless about outline structure even when representing
scripts.
1. In effect, org-babel requires you to put sentinel comments in your
text. This is the opposite of elegant.
2. Afaik, org-babel has no notion of inheritance. With Leo, @language (and
most other directives) whatever applies to the node and all descendants
until overridden. This is a crucial feature!
org-babel seems to think that mixing various languages in a single file is
somehow a big deal. With Leo, it's hardly worth mentioning.
3. Afaik, neither org-mode nor org-babel have any easy way of accessing
text in the outline in which the script resides. Yes, it's surely
possible, as your video shows. But it takes work, it's not natural, it's
clumsy and it's not standard. Anyone using this approach would either have
to reinvent the wheel or import yet another org-mode add on, presumably
written in notoriously-easy-to-use elisp :-)
In contrast, Leo's generators are pythonic, Leonine, and simple. Example::
for p in c.all_positions():
print(p.h)
Afaik, nothing like this *standard* way of accessing nodes exists anywhere
in Emacs.
> Sounds like sentinels allow you to emit a source file from Leo, change the
> source file, and then construct a new Leo file which, if you emit source
> again, would produce the *edited* file. Neat.
>
Correct.
> Let me guess, sentinels live inside comments.. :)
>
Of course. There is no other safe way.
> Is this system aware of the AST of some languages?
>
No. Leo only needs to know how to emit an external file from an outline.
For that, it needs to know only the comment delimiters in effect for a
language. That involves adding new entries in simple data structures
defined in three helper methods of @file leoApp.py-->class
LeoApp-->app.__init__
Cheers, and thanks for the warm words,
>
You're welcome. I am enjoying this discussion.
Edward
--
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/groups/opt_out.