On Mon, 14 Oct 2013 01:05:30 -0700 (PDT)
Fidel N <[email protected]> wrote:

> Terry, could you please share some examples of using Leo with R Statistical 
> Language? 
> Those are the kind of files I would upload together to a "Leo Sample Files" 
> to show how Leo can be used with anything.
> I would be very interested to learn from some of your R files if possible.
> Thank you.

There's not much too it, for both R and coffeescript, I like the node
names to appear in the output like this:

  ### node name ####################################
  
  <content of node>
  
  ### next node name ###############################
  
  <content of next node>
  
I don't find myself using indentation across bodies (@others) in these
languages.

So I use the button I mentioned yesterday, here's the full version
which cleans up end of body whitespace as well:

https://github.com/leo-editor/snippets/blob/master/R_outline.py

I see now I was using @shadow or @nosent to edit files commented this
way.  So the node names are preserved in the otherwise vanilla output
by including them in the body text and periodically updating with the
button - you could tie it to a pre-save hook to have it done
automatically.  The hook could look for some particular @directive,
getting at the new directive approach someone else brought up.

If your question is generally "how do you use Leo for R", then other
features include:

  - Using the leoscreen plugin to pipe commands from body text to R
    running in another window, like the Notepad++ plugin.

  - a @button / @rclick command to send 
    "viewh(summarize(<highlighted text>))" to the R session, which are
    some custom R commands for displaying info about a data.frame, like
    summary().

  - a special abbreviation to insert rst blocks into code written for
    R's knitr package, which tangles R code with rst / latex etc.  The
    abbreviation "..i" expands to

      .. ..
  
      This is necessary because
  
      .. {r blockXX }

    which is basically a switch from R code to rst (".. .."), some text
    to explain the R code (the "This is necessary because" is a
    placeholder which is left highlighted after the abbreviation
    executes), and then the switch back to R code, ".. {r blockXX }",
    with blockXX calculated to be a new block name in the file.

leoscreen works like that for any app. running in a unix shell window
which is running the screen shell window wrapper.

I suppose this could be a blog post or something, although some of the
examples (specific to using the knitr package for example) are a bit
esoteric.

Cheers -Terry


> On Sunday, October 13, 2013 8:52:57 PM UTC+2, wgw wrote:
> >
> > Is there are way to put the outline structure in a user-defined comment 
> > format?  I want to generate a stripped down version of @file, where the 
> > only thing that would be indicated in the #@ comments would be the headings 
> > and their level.  That comment string could be user-defined, so you might 
> > want "#####<legal numbering>" or other.  
> >
> > This would of course lose the directives and so on, but retain the 
> > headings and their hierarchy. A file that is something between the @auto 
> > and the @file format. (Right now, I just reformat the @file and strip 
> > anything that isn't a node.)
> >
> > For example, if the leo headings are: 
> >
> > a
> > .b
> > .c
> > ..d
> > e
> >
> > then the output file would indicate the outline structure by a proper 
> > stacking of #@ :
> >
> > #@ a
> > code and  comments
> > #@#@ b
> > code and  comments
> > #@#@ c
> > code and  comments
> > #@#@#@ d
> > code and  comments
> > #@ e
> > code and  comments
> >
> >
> > Is there any easy way to achieve that output format? 
> >
> > Thanks!
> >
> 

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

Reply via email to