section references...

53 views
Skip to first unread message

Terry Brown

unread,
Apr 27, 2015, 10:40:34 AM4/27/15
to leo-editor
I think in the past we've come to the conclusion that the syntax for
section references can not be user defined - or at least, it would cause
more harm than good to make it user defined.

I want to use a LaTeX variant "Rnw", "R no web", an R code mixed with
LaTeX language described here: http://yihui.name/knitr/demo/minimal/

Basically the syntax is

...some LaTeX stuff here...

<<my-label, eval=TRUE, dev='png'>>=
# R code here
@

...more LaTeX...

i.e. delimiters of `<<.*>>=` and `@` which do not play well at all with
Leo. `@` is problematic syntax coloring wise.

Of course I want to use @clean for this, @asis works, but doesn't
support @others. So I guess it would be great if Leo could turn off
interpretation of section references and doc comments or whatever it is
@ delimits.

But unless it's easy I'm not sure it's worth the trouble, it's not that
hard to use some other arbitrary syntax like `<{.*}>=` and `@@` and
have sed fix it for further processing, or tell knitr to use the
different patterns, but I prefer the sed route so there's a "normal"
Rnw file saved.

So really just an observation, unless there's a simple switch for
section reference management.

Cheers -Terry

Edward K. Ream

unread,
Apr 29, 2015, 7:38:45 AM4/29/15
to leo-editor
​On Mon, Apr 27, 2015 at 9:40 AM, 'Terry Brown' via leo-editor <leo-e...@googlegroups.com> wrote:

i.e. delimiters of `<<.*>>=` and `@` which do not play well at all with
Leo.  `@` is problematic syntax coloring wise.

Of course I want to use @clean for this, @asis works, but doesn't
support @others.  So I guess it would be great if Leo could turn off
interpretation of section references and doc comments or whatever it is
@ delimits.

For @clean nodes at.writeAllHelper calls::

    at.write(p,kind='@clean',nosentinels=True,toString=toString)

at.write calls at.writeOpenFile which calls at.putBody.  The changes would have to be in::

    << handle line at s[i] >> (putBody)

This would not be easy for user code to mess with, so I'm wondering if there is an easier, more general way.  Several possibilities come to mind:

1. @clean-asis.  The write code be similar to the @asis write code (which is simple), except that trailing newlines would be guaranteed for all nodes.  The read code might be identical to @clean code.

2. @user-file.  The read/write code would be specified by the user somehow, probably by a plugin along the lines of the importer/writer plugins. 

3. Change @asis so it works like @clean-asis just described.

4. Use scripts, somehow, to read/write a tree.

#2 is asking for trouble.  Read/code is too complicated to trust to users.

#3 is also asking for trouble: it's never a good idea to change what @<file> directives do.

#4 is always possible, but hard.

So that leaves #1.

Or maybe settings could modify the workings of @clean.  But that's also asking for trouble, even assuming per-commander settings are available when reading @clean nodes.

So again, only #1 looks feasible.

New directives that would modify the workings of @clean (or other @<file> nodes) also look like asking for trouble.

Summary

An @clean-like version of @asis would be good.  Unless I am mistaken, @clean-asis is needed (alternatives are too difficult to trust to users) and fairly straightforward to add to Leo.

Otoh, I am never real happy to add another type of @<file> node.

Your comments, please, Terry.

Edward

Terry Brown

unread,
Apr 29, 2015, 9:56:06 AM4/29/15
to leo-e...@googlegroups.com
> *Summary*
>
> An @clean-like version of @asis would be good. Unless I am mistaken,
> @clean-asis is needed (alternatives are too difficult to trust to
> users) and fairly straightforward to add to Leo.
>
> Otoh, I am never real happy to add another type of @<file> node.
>
> Your comments, please, Terry.

Kind of thinking this is too much trouble for too little reward.
@clean-asis would have to work with @others and maybe @language, not
sure what @asis does with language, so it wouldn't be exactly @asis.

And really, apart from .Rnw files, when is this a problem? Ideally you
want an editor to be able to edit anything without tripping up on
content, but arguable none of the Leo / Emacs / Vi.* editors are immune
to misinterpretation of something, for example the constructs here:
http://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html

And seeing some kind of `make` script is a must for doc.
generation from LaTeX, adding a sed step to translate is trivial.

So I think we're done - I just brought it up in case it was a simple
thing to skip section references.

Off topic: http://pydoit.org/ is my current favorite for complex "make"
like tasks - not necessarily building software, but running complex
analyses of data involving multiple steps in multiple environments.

Cheers -Terry

> Edward
>

Edward K. Ream

unread,
Apr 30, 2015, 2:00:13 PM4/30/15
to leo-editor
On Wed, Apr 29, 2015 at 8:55 AM, 'Terry Brown' via leo-editor <leo-e...@googlegroups.com> wrote:

> Otoh, I am never real happy to add another type of @<file> node.

Kind of thinking this is too much trouble for too little reward.
@clean-asis would have to work with @others and maybe @language, not
sure what @asis does with language, so it wouldn't be exactly @asis.

​Yes.  It's all a bit messy.​
 

And really, apart from .Rnw files, when is this a problem?  Ideally you
want an editor to be able to edit anything without tripping up on
content, but arguable none of the Leo / Emacs / Vi.* editors are immune
to misinterpretation of something
​...
​[snip]​
And seeing some kind of `make` script is a must for doc.
generation from LaTeX, adding a sed step to translate is trivial.

​Interesting.  Glad there is a straightforward way.​
 

So I think we're done - I just brought it up in case it was a simple
thing to skip section references.

​Thanks for these comments.  The simplest way would be to use @asis, but then you get no automatic updates when the external file changes and you have to make sure all nodes end with a newline.

Case closed for now.

EKR
Reply all
Reply to author
Forward
0 new messages