On Wed, Jan 15, 2014 at 8:07 PM, cafea <[email protected]> wrote: > > Is leo capable of handling C++ projects? >
Certainly. Early versions of Leo were written in Borland C contained in a Leo outline. > > I notice that "Leo Cheat Sheet"->"Leo Directives" has an entry > @language c > is that what I'd use, or should there be a setting specific to C++? > Use @language cplusplus Should I just work my way through the leo tutorial for python and learn > python if I want to use leo for C++? > Good question! There are actually very few lines of Python code in the tutorial at: http://leoeditor.com/tutorial-programming.html The main thing to understand is that Leo's markup (@others and section references) works for *all* languages. The tutorial doesn't make this clear. Try this: 1. Create a node whose headline is @file hello.cpp and whose body text is:: @language cplusplus (the text of hello world in c++) 2. Save the outline and look at the resulting file, hello.cpp. 3. Now add @others and section references, as in the tutorial, but use C++ code instead of Python code. Everything should just work. To support @others and section references, the *only* thing that Leo needs to know about any language are its comment delimiters. That's what @language cplusplus does. (The @language directive also controls syntax coloring.) In other words, the code that handles @others and section references knows *nothing* about the syntax of any language. (Leo's importers, used by @auto, *do* know about language syntax, but that is a completely separate matter.) HTH. Please feel free to ask more questions. Edward P.S. Because the code that handles section references knows nothing about language syntax, you have to be careful with C++ << and >> operators. Don't put them on the same line: Leo will think they denote a section reference. This is true also of Python code. It usually doesn't matter, but then I don't write a lot of mathematical code... P.P.S. When you get more experience with Leo, you could try your hand at writing an @button script that will execute the body text of the selected node (and its descendants!) as a C++ script ;-) Leo should already have such a thing, but at present it doesn't. It would be patterned after the code in c.executeScript. 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 [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.
