Romain Francois, Professional R Enthusiast - Tag - nestedIndependant statistical/R consultant2013-03-24T15:53:22+01:00Romain Francoisurn:md5:2cdb21a695f56bfe2b31ee2133c51b42DotclearNested 0.1 on jedit plugin centralurn:md5:32f782bb50769c2f2706a41eaf0bdff62009-02-07T10:34:00+01:00romain francoisjeditnested <p>Nested has been released on <a href="http://plugins.jedit.org/plugins/?Nested">jedit plugin central</a>, you can now install it via jedit's plugin manager</p>
<img src="http://romainfrancois.blog.free.fr/public/posts/nested/Screenshot-1.png" alt="Screenshot-1.png" style="margin: 0 auto; display: block;" title="Screenshot-1.png, fév. 2009" />
<p>In short, <a href="http://romainfrancois.blog.free.fr/index.php?post/2009/02/02/Nested%3A-new-jedit-plugin">nested</a> is a jedit plugin that lets you see when you edit files with <strong>nested</strong> languages, such as for example XML inside R (see <a href="http://romainfrancois.blog.free.fr/index.php?post/2009/02/06/Tag-cloud-for-the-R-Graph-Gallery">this post</a> to find out what the code is about) :</p>
<a href="http://romainfrancois.blog.free.fr/public/posts/nested/Screenshot.png"><img src="http://romainfrancois.blog.free.fr/public/posts/nested/.Screenshot_m.jpg" alt="Screenshot.png" style="margin: 0 auto; display: block;" title="Screenshot.png, fév. 2009" /></a>
<p>Note, you need to install my <a href="http://romainfrancois.blog.free.fr/public/modes/r.xml">R edit mode</a> for jedit to recognize the xml within R.</p>
<pre><font color="#000000"><span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">21 </font></span> <font color="#cc0000"><!--</font><font color="#cc0000"> </font><font color="#cc0000">deal</font><font color="#cc0000"> </font><font color="#cc0000">with</font><font color="#cc0000"> </font><font color="#cc0000">R4X</font><font color="#cc0000"> </font><font color="#cc0000">inline</font><font color="#cc0000"> </font><font color="#cc0000">XML</font><font color="#cc0000"> </font><font color="#cc0000">--></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">22 </font></span> <font color="#0000ff"><</font><font color="#0000ff">SPAN</font><font color="#0000ff"> </font><font color="#0000ff">DELEGATE</font><font color="#0000ff">=</font><font color="#ff00cc">"</font><font color="#ff00cc">xml::MAIN</font><font color="#ff00cc">"</font><font color="#0000ff"> </font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">23 </font></span> <font color="#0000ff"><</font><font color="#0000ff">BEGIN</font><font color="#0000ff">></font>'##((xml<font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">BEGIN</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">24 </font></span> <font color="#0000ff"><</font><font color="#0000ff">END</font><font color="#0000ff">></font>'##xml))<font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">END</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#990066">25 </font></span> <font color="#0000ff"><</font><font color="#0000ff">/</font><font color="#0000ff">SPAN</font><font color="#0000ff">></font>
<span style="background:#dbdbdb; border-right:solid 2px black; margin-right:5px; "><font color="#000000">26 </font></span>
</font></pre>Nested: support for editing multiple languages files in jediturn:md5:b7a8b5737add65a68e518ce47e4b97932009-02-02T08:43:00+01:00romain francoisjeditnested <p>jedit usually makes a good job of editing files with various languages in it, for example jsp files contain some java code, <a href="http://www.stat.uni-muenchen.de/~leisch/Sweave/">sweave</a> files contain some R code, <a href="http://www.rforge.net/brew/">brew</a> templates contain R code, R code might contain XML code (if you use the <a href="http://r-forge.r-project.org/projects/r4x/">R4X</a> package, but we'll get to this one some other time). Unfortunately, because jedit uses the same color styles for all languages, you don't get so much of a visual aid to tell you that you switched languages, enters <code>Nested</code></p>
<p><code>Nested</code> is a simple jedit plugin that paints the background of a code chunk differently if this code is not coming from the same mode as the mode of the buffer, and the color is left to the user's choice. Here is an example with some java code within a JSP file, the pink background around the java statement comes from the Nested plugin.</p>
<img src="http://romainfrancois.blog.free.fr/public/posts/nested/jspjava.png" />
<p>The colours are controlled by a file residing on the plugin directory that looks like this :</p>
<pre style="border:1px solid gray">
html,css,#eeeeee
jaxx,java,#ccff99
jaxx,xml,#ffffff
jsp,java,#fff2ff
</pre>
<p>but you can also use the Nested dockable window to control things</p>
<div style="text-align:center"><img src="http://romainfrancois.blog.free.fr/public/posts/nested/nesteddock.png" alt="nesteddock.png" title="nesteddock.png, fév. 2009" /></div>
<p>Java code will appear in pink inside a jsp file, java code will appear green inside jaxx files, ... and you can click on the colour if you want to change it to something else</p>
<p>When you open a file that contains sub-languages, an entry will automatically be inserted in the settings if it does not exist yet, in that case, the colour used is the same as the background color of the view, so that by default nothing changes.</p>