Commits

ZoomQuiet committed 3b1a245

for bitbucket.org pub change dir name

Comments (0)

Files changed (178)

leo-doc-zh/.buildinfo

-# Sphinx build info version 1
-# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: d231504f156032e1fca2fa0092359aa6
-tags: fbb0d17656682115ca4d033fb2f83ba1

leo-doc-zh/FAQ.html

-
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    
-    <title>FAQ &mdash; Leo v4.9 documentation</title>
-    <link rel="stylesheet" href="_static/default.css" type="text/css" />
-    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
-    <script type="text/javascript">
-      var DOCUMENTATION_OPTIONS = {
-        URL_ROOT:    '',
-        VERSION:     '4.9',
-        COLLAPSE_INDEX: false,
-        FILE_SUFFIX: '.html',
-        HAS_SOURCE:  true
-      };
-    </script>
-    <script type="text/javascript" src="_static/jquery.js"></script>
-    <script type="text/javascript" src="_static/underscore.js"></script>
-    <script type="text/javascript" src="_static/doctools.js"></script>
-    <script type="text/javascript" src="_static/sidebar.js"></script>
-    <link rel="top" title="Leo v4.9 documentation" href="index.html" />
-    <link rel="next" title="Slides" href="slides.html" />
-    <link rel="prev" title="What People Are Saying About Leo" href="testimonials.html" /> 
-  </head>
-  <body>
-    <div class="related">
-      <h3>Navigation</h3>
-      <ul>
-        <li class="right" style="margin-right: 10px">
-          <a href="genindex.html" title="General Index"
-             accesskey="I">index</a></li>
-        <li class="right" >
-          <a href="slides.html" title="Slides"
-             accesskey="N">next</a> |</li>
-        <li class="right" >
-          <a href="testimonials.html" title="What People Are Saying About Leo"
-             accesskey="P">previous</a> |</li>
-        <li><a href="leo_toc.html">Leo v4.9 documentation</a> &raquo;</li> 
-      </ul>
-    </div>  
-
-    <div class="document">
-      <div class="documentwrapper">
-        <div class="bodywrapper">
-          <div class="body">
-            
-  <div class="section" id="faq">
-<h1><a class="toc-backref" href="#id3">FAQ</a><a class="headerlink" href="#faq" title="Permalink to this headline">¶</a></h1>
-<p>This is Leo&#8217;s Frequently Asked Questions document.</p>
-<div class="contents topic" id="contents">
-<span id="index-0"></span><p class="topic-title first">Contents</p>
-<ul class="simple">
-<li><a class="reference internal" href="#faq" id="id3">FAQ</a><ul>
-<li><a class="reference internal" href="#getting-leo" id="id4">Getting Leo</a><ul>
-<li><a class="reference internal" href="#where-can-i-get-official-releases-of-leo" id="id5">Where can I get official releases of Leo?</a></li>
-<li><a class="reference internal" href="#how-do-i-use-bzr-to-get-the-latest-sources-from-leo-s-launchpad-site" id="id6">How do I use bzr to get the latest sources from Leo&#8217;s launchpad site?</a></li>
-<li><a class="reference internal" href="#how-can-i-get-recent-bzr-snapshots-of-leo" id="id7">How can I get recent bzr snapshots of Leo?</a></li>
-</ul>
-</li>
-<li><a class="reference internal" href="#installing-leo" id="id8">Installing Leo</a><ul>
-<li><a class="reference internal" href="#leo-s-installer-failed-what-do-i-do" id="id9">Leo&#8217;s installer failed, what do I do?</a></li>
-<li><a class="reference internal" href="#nothing-or-almost-nothing-happens-when-i-start-leo-what-should-i-do" id="id10">Nothing (or almost nothing) happens when I start Leo.  What should I do?</a></li>
-<li><a class="reference internal" href="#running-python-setup-py-install-from-the-leo-directory-doesn-t-work-why-not" id="id11">Running Python setup.py install from the leo directory doesn&#8217;t work.  Why not?</a></li>
-</ul>
-</li>
-<li><a class="reference internal" href="#learning-to-use-leo" id="id12">Learning to use Leo</a><ul>
-<li><a class="reference internal" href="#what-s-the-best-way-to-learn-to-use-leo" id="id13">What&#8217;s the best way to learn to use Leo?</a></li>
-<li><a class="reference internal" href="#why-should-i-use-clones" id="id14">Why should I use clones?</a></li>
-<li><a class="reference internal" href="#when-is-using-a-section-better-than-using-a-method" id="id15">When is using a section better than using a method?</a></li>
-<li><a class="reference internal" href="#when-is-deleting-a-node-dangerous" id="id16">When is deleting a node dangerous?</a></li>
-<li><a class="reference internal" href="#why-doesn-t-leo-support-cross-file-clones" id="id17">Why doesn&#8217;t Leo support cross-file clones?</a></li>
-<li><a class="reference internal" href="#how-does-ekr-leo-s-developer-use-leo" id="id18">How does EKR (Leo&#8217;s developer) use Leo?</a></li>
-</ul>
-</li>
-<li><a class="reference internal" href="#leo-in-shared-environments" id="id19">Leo in Shared environments</a><ul>
-<li><a class="reference internal" href="#how-should-i-use-leo-with-bzr-git-hg-svn-cvs" id="id20">How should I use Leo with bzr/git/hg/svn/cvs?</a></li>
-<li><a class="reference internal" href="#how-can-i-use-leo-cooperatively-without-sentinels" id="id21">How can I use Leo cooperatively without sentinels?</a></li>
-</ul>
-</li>
-<li><a class="reference internal" href="#using-external-files" id="id22">Using external files</a><ul>
-<li><a class="reference internal" href="#how-do-i-inhibit-sentinels-in-external-files" id="id23">How do I inhibit sentinels in external files?</a></li>
-<li><a class="reference internal" href="#how-do-i-prevent-leo-from-expanding-sections" id="id24">How do I prevent Leo from expanding sections?</a></li>
-<li><a class="reference internal" href="#how-can-i-create-javascript-comments" id="id25">How can I create Javascript comments?</a></li>
-<li><a class="reference internal" href="#how-can-i-disable-php-comments" id="id26">How can I disable PHP comments?</a></li>
-<li><a class="reference internal" href="#how-can-i-use-leo-with-unsupported-languages" id="id27">How can I use Leo with unsupported languages?</a></li>
-<li><a class="reference internal" href="#how-do-i-make-external-files-start-with-a-shebang-line" id="id28">How do I make external files start with a shebang line?</a></li>
-<li><a class="reference internal" href="#can-file-trees-contain-material-not-in-the-external-file" id="id29">Can &#64;file trees contain material not in the external file?</a></li>
-<li><a class="reference internal" href="#how-can-i-use-leo-with-older-c-compilers" id="id30">How can I use Leo with older C compilers</a></li>
-<li><a class="reference internal" href="#why-can-t-i-use-ignore-directives-in-file-trees" id="id31">Why can&#8217;t I use &#64;ignore directives in &#64;file trees?</a></li>
-<li><a class="reference internal" href="#how-can-i-avoid-getting-long-lines-in-external-files" id="id32">How can I avoid getting long lines in external files?</a></li>
-</ul>
-</li>
-<li><a class="reference internal" href="#customizing-leo" id="id33">Customizing Leo</a><ul>
-<li><a class="reference internal" href="#how-can-i-add-support-for-a-new-language" id="id34">How can I add support for a new language?</a></li>
-<li><a class="reference internal" href="#how-do-i-submit-a-plugin" id="id35">How do I submit a plugin?</a></li>
-<li><a class="reference internal" href="#how-do-i-add-a-new-menu-item-from-a-plugin" id="id36">How do I add a new menu item from a plugin?</a></li>
-<li><a class="reference internal" href="#how-can-i-use-leo-s-legacy-key-bindings" id="id37">How can I use Leo&#8217;s legacy key bindings?</a></li>
-<li><a class="reference internal" href="#how-can-i-enable-and-disable-support-for-psyco" id="id38">How can I enable and disable support for psyco?</a></li>
-<li><a class="reference internal" href="#how-do-i-specify-qt-fonts" id="id39">How do I specify qt fonts?</a></li>
-<li><a class="reference internal" href="#how-do-i-set-selection-colors" id="id40">How do I set selection colors?</a></li>
-</ul>
-</li>
-<li><a class="reference internal" href="#tips-and-techniques" id="id41">Tips and techniques</a><ul>
-<li><a class="reference internal" href="#what-is-an-easy-way-to-profile-code" id="id42">What is an easy way to profile code?</a></li>
-<li><a class="reference internal" href="#how-can-i-do-a-simple-find-and-replace" id="id43">How can I do a simple find and replace?</a></li>
-<li><a class="reference internal" href="#how-can-i-use-leo-to-develop-leo-itself" id="id44">How can I use Leo to develop Leo itself?</a></li>
-<li><a class="reference internal" href="#how-can-i-import-many-files-at-once" id="id45">How can I import many files at once?</a></li>
-<li><a class="reference internal" href="#how-can-i-use-two-copies-of-leo-to-advantage" id="id46">How can I use two copies of Leo to advantage?</a></li>
-<li><a class="reference internal" href="#how-can-i-display-graphics-in-leo" id="id47">How can I display graphics in Leo?</a></li>
-<li><a class="reference internal" href="#how-can-i-create-a-template-leo-file" id="id48">How can I create a template .leo file?</a></li>
-<li><a class="reference internal" href="#how-can-i-show-leo-files-with-excel" id="id49">How can I show Leo files with Excel?</a></li>
-<li><a class="reference internal" href="#how-can-i-reuse-button-nodes-in-multiple-files" id="id50">How can I reuse &#64;button nodes in multiple files?</a></li>
-</ul>
-</li>
-<li><a class="reference internal" href="#trouble-shooting" id="id51">Trouble shooting</a><ul>
-<li><a class="reference internal" href="#how-do-i-get-help" id="id52">How do I get help?</a></li>
-<li><a class="reference internal" href="#how-do-i-report-bugs" id="id53">How do I report bugs?</a></li>
-<li><a class="reference internal" href="#my-old-leo-files-won-t-load-using-leo-4-5-or-later-what-should-i-do" id="id54">My old .leo files won&#8217;t load using Leo 4.5 or later. What should I do?</a></li>
-<li><a class="reference internal" href="#error-messages-from-the-rst3-plugin-aren-t-helpful-what-can-i-do" id="id55">Error messages from the rst3 plugin aren&#8217;t helpful. What can I do?</a></li>
-<li><a class="reference internal" href="#how-can-i-run-leo-from-a-console-window" id="id56">How can I run Leo from a console window?</a></li>
-<li><a class="reference internal" href="#how-can-i-use-python-s-pdb-debugger-with-leo" id="id57">How can I use Python&#8217;s pdb debugger with Leo?</a></li>
-<li><a class="reference internal" href="#i-can-t-write-imported-files-what-s-going-on" id="id58">I can&#8217;t write Imported files.  What&#8217;s going on?</a></li>
-<li><a class="reference internal" href="#leo-s-recent-files-menu-doesn-t-work-from-a-cvs-shandbox-what-s-going-on" id="id59">Leo&#8217;s Recent Files menu doesn&#8217;t work from a cvs shandbox.  What&#8217;s going on?</a></li>
-<li><a class="reference internal" href="#id1" id="id60">Nothing (or almost nothing) happens when I start Leo.  What should I do?</a></li>
-<li><a class="reference internal" href="#the-new-python-decorator-syntax-causes-problems-what-can-i-do" id="id61">The new Python decorator syntax causes problems.  What can I do?</a></li>
-<li><a class="reference internal" href="#id2" id="id62">Running Python setup.py install from the leo directory doesn&#8217;t work.  Why not?</a></li>
-<li><a class="reference internal" href="#i-can-t-run-the-leobridge-module-outside-of-leo-core-what-should-i-do" id="id63">I can&#8217;t run the LeoBridge module outside of leo/core.  What should I do?</a></li>
-<li><a class="reference internal" href="#why-didn-t-leo-update-my-shadow-outline-as-expected" id="id64">Why didn&#8217;t Leo update my &#64;shadow outline as expected?</a></li>
-</ul>
-</li>
-<li><a class="reference internal" href="#unicode-issues" id="id65">Unicode issues</a><ul>
-<li><a class="reference internal" href="#i-can-not-enter-non-ascii-characters-what-can-i-do" id="id66">I can not enter non-ascii characters.  What can I do?</a></li>
-<li><a class="reference internal" href="#some-characters-in-external-files-look-funny-what-can-i-do" id="id67">Some characters in external files look funny. What can I do?</a></li>
-<li><a class="reference internal" href="#i-get-weird-results-when-defining-unicode-strings-in-scripts-what-is-going-on" id="id68">I get weird results when defining unicode strings in scripts.  What is going on?</a></li>
-<li><a class="reference internal" href="#some-characters-are-garbled-when-importing-files-what-can-i-do" id="id69">Some characters are garbled when importing files. What can I do?</a></li>
-<li><a class="reference internal" href="#python-s-print-statement-shows-byte-hash-for-unicode-characters-what-can-i-do" id="id70">Python&#8217;s print statement shows &#8216;byte hash&#8217; for unicode characters.  What can I do?</a></li>
-</ul>
-</li>
-</ul>
-</li>
-</ul>
-</div>
-<div class="section" id="getting-leo">
-<h2><a class="toc-backref" href="#id4">Getting Leo</a><a class="headerlink" href="#getting-leo" title="Permalink to this headline">¶</a></h2>
-<div class="section" id="where-can-i-get-official-releases-of-leo">
-<h3><a class="toc-backref" href="#id5">Where can I get official releases of Leo?</a><a class="headerlink" href="#where-can-i-get-official-releases-of-leo" title="Permalink to this headline">¶</a></h3>
-<p>You can get the latest official releases of Leo at
-<a class="reference external" href="http://sourceforge.net/project/showfiles.php?group_id=3458&amp;package_id=29106">http://sourceforge.net/project/showfiles.php?group_id=3458&amp;package_id=29106</a></p>
-<p>However, if at all possible, it is better to use bzr to get the latest sources.  See the next entry.</p>
-</div>
-<div class="section" id="how-do-i-use-bzr-to-get-the-latest-sources-from-leo-s-launchpad-site">
-<h3><a class="toc-backref" href="#id6">How do I use bzr to get the latest sources from Leo&#8217;s launchpad site?</a><a class="headerlink" href="#how-do-i-use-bzr-to-get-the-latest-sources-from-leo-s-launchpad-site" title="Permalink to this headline">¶</a></h3>
-<p>Many users will want to track the development version of Leo, in order to stay
-on top of the latest features and bug fixes. Running the development version is
-quite safe and easy, and it&#8217;s also a requirement if you want to contribute to
-Leo.</p>
-<ol class="arabic">
-<li><p class="first">First, you need to get Bazaar (bzr) from <a class="reference external" href="http://bazaar-vcs.org">http://bazaar-vcs.org</a>. For windows
-users we recommend the standalone installer - the python installer may have
-problems pushing to Launchpad. Plain bzr installer only contains the command
-line version, so you might want to augment that with a friendly GUI - qbzr is
-recommended as it&#8217;s the easiest one to install. It provides command like
-&#8216;bzr qlog&#8217;, &#8216;bzr qannotate&#8217; etc.</p>
-</li>
-<li><p class="first">Get Leo from launchpad by doing:</p>
-<div class="highlight-python"><pre>bzr branch lp:leo-editor</pre>
-</div>
-</li>
-</ol>
-<p>And that&#8217;s it! You can run the launchLeo script (in the top-level branch directory) directly.
-When you want to refresh the code with latest modifications from Launchpad, &#8216;run bzr pull&#8217;.</p>
-<p>If you make modifications to Leo (with the interest in sharing them with the Leo
-community), you can check them in to your local branch by doing &#8216;bzr checkin&#8217;.
-Now, to actually request your changes to be merged to Leo trunk, you need a
-Launchpad account with RSA keys in place. There is showmedo video about how to
-accomplish this on Windows using puttygen and pageant at
-<a class="reference external" href="http://showmedo.com/videos/video?name=1510070&amp;fromSeriesID=151">http://showmedo.com/videos/video?name=1510070&amp;fromSeriesID=151</a>.</p>
-<p>After your Launchpad account is set up, go to
-<a class="reference external" href="https://launchpad.net/leo-editor">https://launchpad.net/leo-editor</a>, choose Code tab -&gt; Register Branch, select
-Branch type &#8220;Hosted&#8221; and fill in descriptive details about the branch. After
-that, go to the branch home page from Code tab again, and copy-paste the push
-command line to terminal. For example, for branch:</p>
-<div class="highlight-python"><pre>https://code.launchpad.net/~leo-editor-team/leo-editor/mod_rclick</pre>
-</div>
-<p>The push command is:</p>
-<div class="highlight-python"><pre>bzr push bzr+ssh://my_name@bazaar.launchpad.net/~leo-editor-team/leo-editor/mod_rclick</pre>
-</div>
-<p>You may wish to add &#8211;remember command line option to bzr push, to direct all
-future pushes to that location. Then, you only need to execute &#8216;bzr push&#8217;.</p>
-<p>After your branch is pushed, you can email the Leo mailing list and request it
-to be reviewed and merged to trunk.</p>
-<p>&#8211; Ville M. Vainio - vivainio.googlepages.com</p>
-</div>
-<div class="section" id="how-can-i-get-recent-bzr-snapshots-of-leo">
-<h3><a class="toc-backref" href="#id7">How can I get recent bzr snapshots of Leo?</a><a class="headerlink" href="#how-can-i-get-recent-bzr-snapshots-of-leo" title="Permalink to this headline">¶</a></h3>
-<p>Daily snapshots are available at <a class="reference external" href="http://www.greygreen.org/leo/">http://www.greygreen.org/leo/</a></p>
-</div>
-</div>
-<div class="section" id="installing-leo">
-<h2><a class="toc-backref" href="#id8">Installing Leo</a><a class="headerlink" href="#installing-leo" title="Permalink to this headline">¶</a></h2>
-<div class="section" id="leo-s-installer-failed-what-do-i-do">
-<h3><a class="toc-backref" href="#id9">Leo&#8217;s installer failed, what do I do?</a><a class="headerlink" href="#leo-s-installer-failed-what-do-i-do" title="Permalink to this headline">¶</a></h3>
-<p>You can simply unpack Leo anywhere and run from there.  You don&#8217;t need the
-installer.</p>
-<p>From a console window, cd to the top-level leo folder.  Run Leo as follows:</p>
-<div class="highlight-python"><pre>python launchLeo.py</pre>
-</div>
-<p>To run Leo with Qt look and feel, use the &#8211;gui=qt option:</p>
-<div class="highlight-python"><pre>python launchLeo.py --gui=qt</pre>
-</div>
-<p>To load Leo&#8217;s source, load leoPyRef.leo:</p>
-<div class="highlight-python"><pre>python launchLeo.py --gui=qt leo\\core\\leoPyRef.leo</pre>
-</div>
-</div>
-<div class="section" id="nothing-or-almost-nothing-happens-when-i-start-leo-what-should-i-do">
-<h3><a class="toc-backref" href="#id10">Nothing (or almost nothing) happens when I start Leo.  What should I do?</a><a class="headerlink" href="#nothing-or-almost-nothing-happens-when-i-start-leo-what-should-i-do" title="Permalink to this headline">¶</a></h3>
-<p>Missing modules can cause installation problems.
-If the installer doesn&#8217;t work (or puts up a dialog containing no text), you may install Leo from the .zip file
-as described at <a class="reference external" href="installing.html#how-to-install-leo-on-windows">How to install Leo on Windows</a>.
-However you are installing Leo,
-be sure to <a class="reference external" href="installing.html#running-leo-from-a-console-window">run Leo in a console window</a>.
-because as a last resort Leo prints error messages to the console.</p>
-</div>
-<div class="section" id="running-python-setup-py-install-from-the-leo-directory-doesn-t-work-why-not">
-<h3><a class="toc-backref" href="#id11">Running Python setup.py install from the leo directory doesn&#8217;t work.  Why not?</a><a class="headerlink" href="#running-python-setup-py-install-from-the-leo-directory-doesn-t-work-why-not" title="Permalink to this headline">¶</a></h3>
-<p>Leo&#8217;s setup.py script is intended only to create source distributions. It can&#8217;t
-be used to install Leo because Leo is not a Python package.</p>
-</div>
-</div>
-<div class="section" id="learning-to-use-leo">
-<h2><a class="toc-backref" href="#id12">Learning to use Leo</a><a class="headerlink" href="#learning-to-use-leo" title="Permalink to this headline">¶</a></h2>
-<div class="section" id="what-s-the-best-way-to-learn-to-use-leo">
-<h3><a class="toc-backref" href="#id13">What&#8217;s the best way to learn to use Leo?</a><a class="headerlink" href="#what-s-the-best-way-to-learn-to-use-leo" title="Permalink to this headline">¶</a></h3>
-<p>First, read the <a class="reference external" href="intro.html">tutorial</a>. This will be enough to get you started if you just
-want to use Leo as an <a class="reference external" href="glossary.html#outliner">outliner</a>. If you intend to use Leo for programming, read
-the <a class="reference external" href="intro.html#quick-start-for-programmers">Quick start for programmers</a>, then look at Leo&#8217;s source code in the file LeoPy.leo.
-Spend 5 or 10 minutes browsing through the outline. Don&#8217;t worry about details;
-just look for the following common usage patterns:</p>
-<ul class="simple">
-<li>The (Projects) tree shows how to use clones to represent tasks.</li>
-<li>Study &#64;file leoNodes.py.
-It shows how to define more than one class in single file.</li>
-<li>Most other files show how to use a single &#64;others directive to define one class.</li>
-<li>Most methods are defined using &#64;others, <em>not</em> section definition nodes.</li>
-</ul>
-</div>
-<div class="section" id="why-should-i-use-clones">
-<h3><a class="toc-backref" href="#id14">Why should I use clones?</a><a class="headerlink" href="#why-should-i-use-clones" title="Permalink to this headline">¶</a></h3>
-<p>You will lose much of Leo&#8217;s power if you don&#8217;t use clones.
-See <a class="reference external" href="intro.html#clones-views">Clones &amp; views</a> for full details.</p>
-</div>
-<div class="section" id="when-is-using-a-section-better-than-using-a-method">
-<h3><a class="toc-backref" href="#id15">When is using a section better than using a method?</a><a class="headerlink" href="#when-is-using-a-section-better-than-using-a-method" title="Permalink to this headline">¶</a></h3>
-<p>Use methods for any code that is used (called or referenced) more than once.</p>
-<p><a class="reference external" href="glossary.html#sections">Sections</a> are convenient in the following circumstances:</p>
-<ul>
-<li><p class="first">When you want to refer to snippets of code the can not be turned into methods.
-For example, many plugins start with the code like this:</p>
-<div class="highlight-python"><pre>&lt;&lt; docstring &gt;&gt;
-&lt;&lt; imports &gt;&gt;
-&lt;&lt; version history &gt;&gt;
-&lt;&lt; globals &gt;&gt;</pre>
-</div>
-<p>None of these sections could be replaced by methods.</p>
-</li>
-<li><p class="first">When you want to refer to a snippet of code that shares local variables with the enclosing code.
-This is surprisingly easy and safe to do, <em>provided</em> the section is used only in one place.
-<a class="reference external" href="glossary.html#section-names">Section names</a> in such contexts can be clearer than method names.  For example:</p>
-<div class="highlight-python"><pre>&lt;&lt; init ivars for writing &gt;&gt;</pre>
-</div>
-</li>
-</ul>
-<p>In short, I create sections when convenient,
-and convert them to functions or methods if they need to be used in several places.</p>
-</div>
-<div class="section" id="when-is-deleting-a-node-dangerous">
-<h3><a class="toc-backref" href="#id16">When is deleting a node dangerous?</a><a class="headerlink" href="#when-is-deleting-a-node-dangerous" title="Permalink to this headline">¶</a></h3>
-<p>A <strong>dangerous</strong> delete is a deletion of a node so that all the data in the node
-is deleted <em>everywhere</em> in an outline. The data is gone, to be retrieved only
-via undo or via backups. It may not be obvious which deletes are dangerous in an
-outline containing clones. Happily, there is a very simple rule of thumb:</p>
-<div class="highlight-python"><pre>Deleting a non-cloned node is *always* dangerous.
-Deleting a cloned node is *never* dangerous.</pre>
-</div>
-<p>We could also consider a delete to be dangerous <strong>if it results in a node being
-omitted from an external file.</strong> This can happen as follows. Suppose we have the
-following outline (As usual, A&#8217; indicates that A is marked with a clone mark):</p>
-<div class="highlight-python"><pre>- @file spam.py
-    - A'
-        - B
-- Projects
-    - A'
-        - B</pre>
-</div>
-<p>Now suppose we clone B, and move the clone so the tree looks like this:</p>
-<div class="highlight-python"><pre>- @file spam.py
-    - A'
-        - B'
-- Projects
-    - A'
-        - B'
-    - B'</pre>
-</div>
-<p>If (maybe much later), we eliminate B&#8217; as a child of A will get:</p>
-<div class="highlight-python"><pre>- @file spam.py
-    - A'
-- Projects
-    - A'
-    - B</pre>
-</div>
-<p>B has not been destroyed, but B is gone from &#64;file spam.py! So in this sense deleting a clone node can also be called dangerous.</p>
-</div>
-<div class="section" id="why-doesn-t-leo-support-cross-file-clones">
-<h3><a class="toc-backref" href="#id17">Why doesn&#8217;t Leo support cross-file clones?</a><a class="headerlink" href="#why-doesn-t-leo-support-cross-file-clones" title="Permalink to this headline">¶</a></h3>
-<p>Cross-file clones are cloned nodes in one outline that refer to data in another
-outline. This is a frequently requested feature. For example:</p>
-<div class="highlight-python"><pre>I would absolutely love to have the leo files in different project
-directories, and a "master" leo file to rule them all.</pre>
-</div>
-<p>However, cross-file clones will never be a part of Leo. Indeed, cross-file
-clones would violate the principle that data should be defined and managed in
-exactly one place. Just as human managers would not willingly accept shared
-responsibility for even a single line of code, every piece of Leonine data
-should be the responsibility of one and <em>only</em> one .leo file.</p>
-<p>The problem fundamental. If the <em>same</em> (cloned) data were &#8220;owned&#8221; by two
-different Leo files we would have a classic &#8220;multiple update problem&#8221; for the
-data. Each outline could change the data in incompatible ways, and whichever
-outline changed the data last would &#8220;win.&#8221;</p>
-<p>To make such a scheme workable and safe, one would have to devise a scheme that
-would keep the data in &#8220;component&#8221; .leo files consistent even when the component
-.leo files changed &#8220;randomly&#8221;, without the &#8220;master&#8221; .leo file being in <em>any</em> way
-in &#8220;control&#8221; of the changes. Good luck :-)</p>
-<p>Let us be clear: it&#8217;s no good having a scheme that works <em>most</em> of the time, it
-must work <em>all</em> the time, even with unexpected or even pathological file
-updates. If it doesn&#8217;t you are asking for, and will eventually get, catastrophic
-data loss, without being aware of the loss for an arbitrarily long period of
-time. Even with a source code control system this would be an intolerable
-situation.</p>
-</div>
-<div class="section" id="how-does-ekr-leo-s-developer-use-leo">
-<h3><a class="toc-backref" href="#id18">How does EKR (Leo&#8217;s developer) use Leo?</a><a class="headerlink" href="#how-does-ekr-leo-s-developer-use-leo" title="Permalink to this headline">¶</a></h3>
-<p>Here is the workflow I use to develop Leo. The intention is to help
-present and potential developers use Leo effectively.</p>
-<div class="section" id="overview">
-<h4>Overview<a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h4>
-<ul class="simple">
-<li>Develop in an outline containing all of Leo&#8217;s source files. Close this outline
-rarely: this keeps the code I am using stable while I&#8217;m hacking the code.</li>
-<li>Test in a <em>separate</em> .leo file, say test.leo. In fact, I often test in a
-private file, ekr.leo, so that test.leo doesn&#8217;t get continually updated on bzr
-with trivial changes.</li>
-</ul>
-<p>These two points are covered in a bit more detail in <a class="reference external" href="http://webpages.charter.net/edreamleo/FAQ.html#how-can-i-use-leo-to-develop-leo-itself">This FAQ entry</a>.</p>
-</div>
-<div class="section" id="additional-tips">
-<h4>Additional tips<a class="headerlink" href="#additional-tips" title="Permalink to this headline">¶</a></h4>
-<p>A. Avoid using the mouse whenever possible. For example, use alt-tab to switch
-between windows.</p>
-<ol class="upperalpha simple" start="2">
-<li>Always develop Leo in a console. This allows you to see the output of g.trace.</li>
-</ol>
-<p>Speaking of g.trace, I hardly ever use &#8216;print&#8217; because g.trace prints the name
-of the function or method in which it appears. The typical pattern for enabling
-traces is:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">trace</span> <span class="o">=</span> <span class="bp">True</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">g</span><span class="o">.</span><span class="n">unitTesting</span>
-<span class="k">if</span> <span class="n">trace</span><span class="p">:</span> <span class="n">g</span><span class="o">.</span><span class="n">trace</span><span class="p">(</span><span class="n">whatever</span><span class="p">)</span>
-</pre></div>
-</div>
-<p>This pattern is especially useful when a method contains multiple calls to
-g.trace.</p>
-<ol class="upperalpha" start="3">
-<li><p class="first">I use scripts to open particular Leo files. These are batch files on Windows,
-and aliases on Linux, but invoking them is the same on either platform:</p>
-<div class="highlight-python"><pre>all:     opens all my main development files using the qt-tabs gui.
-t:       opens test.leo.
-e:       opens ekr.leo.  I use this file for private testing.
-d:       opens LeoDocs.leo.
-s:       opens LeoPy.leo.
-plugins: opens leoPlugins.leo.
-gui:     opens leoGui.leo.
-u:       opens unitTest.leo.</pre>
-</div>
-</li>
-</ol>
-<blockquote>
-These run Leo with Python 3.x. There are similar scripts, ending in 2, that run
-Leo with Python 2.x. For example, u2 opens unitTest.leo with Python 2.x.
-Thus, to run a test, I alt-tab to an available console window, then type &#8216;e&#8217; or
-&#8216;t&#8217; or &#8216;u&#8217; or, if I want Python 2.x, &#8216;e2&#8217; or &#8216;t2&#8217; or &#8216;u2&#8217;.</blockquote>
-<ol class="upperalpha simple" start="4">
-<li>Use clones to focus attention on the task at hand.
-For more details, see <a class="reference external" href="http://webpages.charter.net/edreamleo/intro.html#clones-views">about clones and views</a>.</li>
-<li>For thousand of example of my programming style, see leoPy.leo and
-leoGuiPlugins.leo. The projects section in leoPy.leo contains many examples
-of using clones to create view nodes. I typically delete the clones in the
-views shortly before a release.</li>
-</ol>
-</div>
-<div class="section" id="writing-documentation">
-<h4>Writing documentation<a class="headerlink" href="#writing-documentation" title="Permalink to this headline">¶</a></h4>
-<ul>
-<li><p class="first">Use postings as pre-writing for documentation.</p>
-<p>I don&#8217;t mind blabbing on and on about Leo because all my posts become
-pre-writing for Leo&#8217;s documentation. I simply copy posts to nodes in the
-&#8220;documentation to-do&#8221; section. At release time, I edit these nodes and put
-them in Leo&#8217;s main documentation or the release notes. This posting is an
-example.</p>
-</li>
-<li><dl class="first docutils">
-<dt>Use the vr command to debug reStructuredText documentation. The viewrendered</dt>
-<dd><p class="first last">pane updates as you type. This makes Leo a killer app for rST.</p>
-</dd>
-</dl>
-</li>
-</ul>
-</div>
-<div class="section" id="administrative-tips">
-<h4>Administrative tips<a class="headerlink" href="#administrative-tips" title="Permalink to this headline">¶</a></h4>
-<ul>
-<li><p class="first">Never rely on memory.</p>
-<blockquote>
-<p>A project like this contains thousands and thousands of details. Everything
-eventually goes into a Leo node somewhere. If it doesn&#8217;t it surely <em>will</em> be
-forgotten.</p>
-</blockquote>
-</li>
-<li><p class="first">Do easy items first.</p>
-<blockquote>
-<p>This keeps to-do lists short, which keeps energy high.</p>
-</blockquote>
-</li>
-</ul>
-</div>
-<div class="section" id="tips-for-using-bzr">
-<h4>Tips for using bzr<a class="headerlink" href="#tips-for-using-bzr" title="Permalink to this headline">¶</a></h4>
-<p>I use the following batch files related to bzr:</p>
-<div class="highlight-python"><pre>b:      short for bzr
-b c:    short for bzr commit
-bs:     short for bzr status
-tr:     short for cd &lt;path to trunk&gt;
-main:   short for cd &lt;path to copy of trunk&gt;</pre>
-</div>
-<p>The &#8220;main&#8221; (copy) of the trunk is purely for handling bzr conflicts.
-If one happens I do this:</p>
-<div class="highlight-python"><pre>main
-b pull
-b merge ../trunk
-b c -m "my commit message"
-b push</pre>
-</div>
-<p>If the merge goes well (it usually does), I do this to resolve the conflict:</p>
-<div class="highlight-python"><pre>tr
-b pull</pre>
-</div>
-</div>
-</div>
-</div>
-<div class="section" id="leo-in-shared-environments">
-<h2><a class="toc-backref" href="#id19">Leo in Shared environments</a><a class="headerlink" href="#leo-in-shared-environments" title="Permalink to this headline">¶</a></h2>
-<div class="section" id="how-should-i-use-leo-with-bzr-git-hg-svn-cvs">
-<h3><a class="toc-backref" href="#id20">How should I use Leo with bzr/git/hg/svn/cvs?</a><a class="headerlink" href="#how-should-i-use-leo-with-bzr-git-hg-svn-cvs" title="Permalink to this headline">¶</a></h3>
-<p>Using &#64;file trees can eliminate most problems with using Leo in cooperative
-(SCCS) environments:</p>
-<ul class="simple">
-<li>Developers should use &#64;file trees to create external files in any kind of
-cooperative environment.</li>
-<li>If sentinels are frowned upon in your development community, use &#64;auto or
-&#64;shadow instead of &#64;file.</li>
-<li>The repository contains <strong>reference</strong> .leo files. These reference files should
-contain nothing but &#64;file nodes. Reference files should change only when
-new external files get added to the project. Leo&#8217;s <a class="reference external" href="https//code.launchpad.net/leo-editor/">bzr repository</a> and Leo
-distributions contain the following reference files: LeoPyRef.leo,
-LeoPluginsRef.leo and leoGuiPluginsRef.leo. Developers should use
-local copies of reference files for their own work. For example, instead of
-using LeoPyRef.leo directly, I use a copy called LeoPy.leo.</li>
-</ul>
-</div>
-<div class="section" id="how-can-i-use-leo-cooperatively-without-sentinels">
-<h3><a class="toc-backref" href="#id21">How can I use Leo cooperatively without sentinels?</a><a class="headerlink" href="#how-can-i-use-leo-cooperatively-without-sentinels" title="Permalink to this headline">¶</a></h3>
-<p>Leo&#8217;s sentinels add outline structure to source files.
-However, those sentinels annoy some people who don&#8217;t use Leo.</p>
-<p>You can use &#64;auto, &#64;shadow or &#64;nosent trees to edit
-files that are shared with those who don&#8217;t want to see sentinel comments.</p>
-<ul class="simple">
-<li>&#64;auto is best for files whose imported outline structure often changes. In
-most cases, this will be the best option. The drawback of &#64;auto files are a)
-you can&#8217;t use clones and b) you can&#8217;t add your own organizer nodes.</li>
-<li>&#64;shadow will work for files whose outline structure seldom changes.
-The advantage of &#64;shadow is that you can add your own structure.</li>
-<li>&#64;nosent is appropriate only for files that you alone modify.</li>
-</ul>
-</div>
-</div>
-<div class="section" id="using-external-files">
-<h2><a class="toc-backref" href="#id22">Using external files</a><a class="headerlink" href="#using-external-files" title="Permalink to this headline">¶</a></h2>
-<div class="section" id="how-do-i-inhibit-sentinels-in-external-files">
-<h3><a class="toc-backref" href="#id23">How do I inhibit sentinels in external files?</a><a class="headerlink" href="#how-do-i-inhibit-sentinels-in-external-files" title="Permalink to this headline">¶</a></h3>
-<p>You have two options, depending on whether you want to be able to use sections
-or not.</p>
-<ul class="simple">
-<li>Use &#64;nosent trees.
-Files derived from &#64;nosent trees contain no <a class="reference external" href="glossary.html#sentinels">sentinels</a>.
-However, Leo create the external file just as in &#64;file trees.
-In particular, Leo expands section references and understands the &#64;others directive.</li>
-<li>Use &#64;asis trees.
-Files derived from &#64;asis trees contain no <a class="reference external" href="glossary.html#sentinels">sentinels</a>.
-Moreover, Leo does not expand section references in asis trees.
-In other words, Leo creates the <cite>external file</cite> simply by writing all body text in outline order.
-Leo can&#8217;t update the outline unless the external file contains sentinels,
-so Leo does not update &#64;nosent trees or &#64;asis trees automatically when
-you change the external file in an external editor.</li>
-</ul>
-</div>
-<div class="section" id="how-do-i-prevent-leo-from-expanding-sections">
-<h3><a class="toc-backref" href="#id24">How do I prevent Leo from expanding sections?</a><a class="headerlink" href="#how-do-i-prevent-leo-from-expanding-sections" title="Permalink to this headline">¶</a></h3>
-<p>Use &#64;asis trees. Files derived from &#64;asis trees contain no sentinels. Leo
-creates the external file simply by writing all body text in outline order. Leo
-can&#8217;t update the outline unless the external file contains sentinels, so Leo
-does not update &#64;asis trees automatically when you change the external file in
-an external editor.</p>
-</div>
-<div class="section" id="how-can-i-create-javascript-comments">
-<h3><a class="toc-backref" href="#id25">How can I create Javascript comments?</a><a class="headerlink" href="#how-can-i-create-javascript-comments" title="Permalink to this headline">¶</a></h3>
-<p><strong>Question</strong>: I&#8217;m writing a Windows Script Component, which is an XML file with
-a CData section containing javascript. I can get the XML as I want it by using
-&#64;language html, but how can I get the tangling comments inside the CData
-section to be java-style comments rather than html ones?</p>
-<p><strong>Answer</strong>: In &#64;file trees you use the &#64;delims directive to change comment delimiters.
-For example:</p>
-<div class="highlight-python"><pre>@delims /* */
-Javascript stuff
-@delims &lt;-- --&gt;
-HTML stuff</pre>
-</div>
-<p><strong>Important</strong>: Leo can not revert to previous delimiters automatically;
-you must change back to previous delimiters using another &#64;delims <a class="reference external" href="glossary.html#directive">directive</a>.</p>
-</div>
-<div class="section" id="how-can-i-disable-php-comments">
-<h3><a class="toc-backref" href="#id26">How can I disable PHP comments?</a><a class="headerlink" href="#how-can-i-disable-php-comments" title="Permalink to this headline">¶</a></h3>
-<p>By Zvi Boshernitzan: I was having trouble disabling &#8216;&lt;?php&#8217; with comments (and
-couldn&#8217;t override the comment character for the start of the page). Finally, I
-found a solution that worked, using php&#8217;s heredoc string syntax:</p>
-<div class="highlight-python"><pre>@first &lt;?php
-@first $comment = &lt;&lt;&lt;EOD
-EOD;
-
-// php code goes here.
-echo "boogie";
-
-$comment2 = &lt;&lt;&lt;EOD
-@last EOD;
-@last ?&gt;</pre>
-</div>
-<p>or:</p>
-<div class="highlight-python"><pre>@first &lt;?php
-@first /*
-*/
-
-echo "hi";
-
-@delims /* */
-@last ?&gt;</pre>
-</div>
-</div>
-<div class="section" id="how-can-i-use-leo-with-unsupported-languages">
-<h3><a class="toc-backref" href="#id27">How can I use Leo with unsupported languages?</a><a class="headerlink" href="#how-can-i-use-leo-with-unsupported-languages" title="Permalink to this headline">¶</a></h3>
-<p>Here is a posting which might be helpful:
-<a class="reference external" href="http://sourceforge.net/forum/message.php?msg_id=2300457">http://sourceforge.net/forum/message.php?msg_id=2300457</a> The &#64;first
-<a class="reference external" href="glossary.html#directive">directive</a> is the key to output usable code in unsupported languages. For
-example, to use Leo with the Basic language, use the following:</p>
-<div class="highlight-python"><pre>@first $IFDEF LEOHEADER
-@delims '
-@c
-$ENDIF</pre>
-</div>
-<p>So this would enable a basic compiler to &#8220;jump&#8221; over the &#8220;true&#8221; LEO-header-lines.
-Like this:</p>
-<div class="highlight-python"><pre>$IFDEF LEOHEADER &lt;-conditional compilation directive
-#@+leo-ver=4 &lt;-these lines not compiled
-#@+node:@file QParser005.INC
-#@@first
-#@delims '
-'@@c
-$ENDIF &lt;-... Until here!
-&lt;rest of derived code file ... &gt;</pre>
-</div>
-<p>This changes the comment symbol the apostrophe,
-making comments parseable by a BASIC (or other language.)</p>
-</div>
-<div class="section" id="how-do-i-make-external-files-start-with-a-shebang-line">
-<h3><a class="toc-backref" href="#id28">How do I make external files start with a shebang line?</a><a class="headerlink" href="#how-do-i-make-external-files-start-with-a-shebang-line" title="Permalink to this headline">¶</a></h3>
-<p>Use the &#64;first <a class="reference external" href="glossary.html#directive">directive</a> in &#64;file trees or &#64;nosent trees.</p>
-<p>The &#64;first directive puts lines at the very start of files derived from &#64;file.
-For example, the body text of &#64;file spam.py might be:</p>
-<div class="highlight-python"><pre>@first #! /usr/bin/env python</pre>
-</div>
-<p>The body text of &#64;file foo.pl might be:</p>
-<div class="highlight-python"><pre>@first #/usr/bin/perl</pre>
-</div>
-<p>Leo recognizes the &#64;first <a class="reference external" href="glossary.html#directive">directive</a> only at the start of the body text of &#64;file nodes.
-No text may precede &#64;first <a class="reference external" href="glossary.html#directives">directives</a>.
-More than one &#64;first directive may exist, like this:</p>
-<div class="highlight-python"><pre>@first #! /usr/bin/env python
-@first # more comments.</pre>
-</div>
-</div>
-<div class="section" id="can-file-trees-contain-material-not-in-the-external-file">
-<h3><a class="toc-backref" href="#id29">Can &#64;file trees contain material not in the external file?</a><a class="headerlink" href="#can-file-trees-contain-material-not-in-the-external-file" title="Permalink to this headline">¶</a></h3>
-<p>No. Everything in an &#64;file trees must be part of the external file: orphan and
-&#64;ignore nodes are invalid in &#64;file trees. This restriction should not be
-troublesome. For example, you can organize your outline like this:</p>
-<div class="highlight-python"><pre>+ myClass
-..+ ignored stuff
-..+ @file myClass</pre>
-</div>
-<p>(As usual, + denotes a headline.) So you simply create a new <a class="reference external" href="glossary.html#node">node</a>, called
-myClass, that holds your &#64;file trees and stuff you don&#8217;t want in the &#64;file
-trees.</p>
-</div>
-<div class="section" id="how-can-i-use-leo-with-older-c-compilers">
-<h3><a class="toc-backref" href="#id30">How can I use Leo with older C compilers</a><a class="headerlink" href="#how-can-i-use-leo-with-older-c-compilers" title="Permalink to this headline">¶</a></h3>
-<p>By Rich Ries.
-Some older C compilers don&#8217;t understand the &#8220;//&#8221; comment symbol, so using &#64;language C won&#8217;t work.
-Moreover, the following does not always work either:</p>
-<div class="highlight-python"><pre>@comment /* */</pre>
-</div>
-<p>This generates the following sentinel line:</p>
-<div class="highlight-python"><pre>/*@@comment /* */*/</pre>
-</div>
-<p>in the output file, and not all C compilers allow nested comments, so the last */ generates an error.
-The solution is to use:</p>
-<div class="highlight-python"><pre>#if 0
-@comment /* */
-#endif</pre>
-</div>
-<p>Leo is happy: it recognizes the &#64;comment <a class="reference external" href="glossary.html#directive">directive</a>.
-The C compiler is happy: the C preprocessor strips out the offending line before the C
-compiler gets it.</p>
-</div>
-<div class="section" id="why-can-t-i-use-ignore-directives-in-file-trees">
-<h3><a class="toc-backref" href="#id31">Why can&#8217;t I use &#64;ignore directives in &#64;file trees?</a><a class="headerlink" href="#why-can-t-i-use-ignore-directives-in-file-trees" title="Permalink to this headline">¶</a></h3>
-<p>The &#64;ignore directive can not be used elsewhere in &#64;file trees because of the way Leo recreates
-outlines from external files. This is an absolutely crucial restriction and will never go away.
-For a few more details, see <a class="reference external" href="history.html#leo-4-0-eliminating-error-recovery">Leo 4.0: Eliminating error &#8216;recovery&#8217;</a> in <a class="reference external" href="history.html">History of Leo</a>.</p>
-<p>There are several workaround, as shown in LeoPy.leo:</p>
-<ul class="simple">
-<li>keep notes in the outline outside of any external file.</li>
-<li>Use &#64;all to gather notes in a external file, as in done in &#64;file leoProjects.txt.</li>
-</ul>
-</div>
-<div class="section" id="how-can-i-avoid-getting-long-lines-in-external-files">
-<h3><a class="toc-backref" href="#id32">How can I avoid getting long lines in external files?</a><a class="headerlink" href="#how-can-i-avoid-getting-long-lines-in-external-files" title="Permalink to this headline">¶</a></h3>
-<p><strong>Question</strong>: I must follow a coding standard when writing source code. It
-includes a maximum line length restriction. How can I know the length of a
-line when it gets written to the external file?</p>
-<p><strong>Answer</strong>: If a node belongs to a external file hierarchy, its body might get
-indented when it is written to the external file. It happens when an
-&#64;others directive or a section name appears indented in a higher-level
-node body. While (<strong>line</strong>, <strong>col</strong>) in status area show the line and column
-containing the body text&#8217;s cursor, <strong>fcol</strong> shows the cursor coordinate
-relative to the external file, not to the current node. The relation
-<strong>fcol &gt;= col</strong> is always true.</p>
-</div>
-</div>
-<div class="section" id="customizing-leo">
-<h2><a class="toc-backref" href="#id33">Customizing Leo</a><a class="headerlink" href="#customizing-leo" title="Permalink to this headline">¶</a></h2>
-<div class="section" id="how-can-i-add-support-for-a-new-language">
-<h3><a class="toc-backref" href="#id34">How can I add support for a new language?</a><a class="headerlink" href="#how-can-i-add-support-for-a-new-language" title="Permalink to this headline">¶</a></h3>
-<p>See the instructions are in LeoPy.leo in:</p>
-<div class="highlight-python"><pre>Notes:How To:How to add support for a new language section.</pre>
-</div>
-<p>This section contains clones of all relevant parts of Leo that you will change.
-Coming in Leo 4.4: Leo will use JEdit&#8217;s language description files to drive the
-syntax colorer. To add support for a new language, just add another such
-description file.</p>
-</div>
-<div class="section" id="how-do-i-submit-a-plugin">
-<h3><a class="toc-backref" href="#id35">How do I submit a plugin?</a><a class="headerlink" href="#how-do-i-submit-a-plugin" title="Permalink to this headline">¶</a></h3>
-<p>You have two options:</p>
-<ul class="simple">
-<li>Get cvs write access, and add the &#64;file file to the plugins directory.</li>
-<li>Just send the &#64;file file to me at <a class="reference external" href="mailto:edreamleo&#37;&#52;&#48;gmail&#46;com">edreamleo<span>&#64;</span>gmail<span>&#46;</span>com</a>.
-That&#8217;s all you need to do.  In particular that there is no need to change leoPlugins.leo.</li>
-</ul>
-</div>
-<div class="section" id="how-do-i-add-a-new-menu-item-from-a-plugin">
-<h3><a class="toc-backref" href="#id36">How do I add a new menu item from a plugin?</a><a class="headerlink" href="#how-do-i-add-a-new-menu-item-from-a-plugin" title="Permalink to this headline">¶</a></h3>
-<p>c.frame.menu.createMenuItemsFromTable will append items to the end of an existing menu.
-For example, the following script will add a new item at the end of the &#8216;File&#8217; menu:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">callback</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span><span class="o">**</span><span class="n">keys</span><span class="p">):</span>
-    <span class="n">g</span><span class="o">.</span><span class="n">trace</span><span class="p">()</span>
-
-<span class="n">table</span> <span class="o">=</span> <span class="p">((</span><span class="s">&quot;Test1&quot;</span><span class="p">,</span><span class="bp">None</span><span class="p">,</span><span class="n">callback</span><span class="p">),)</span>
-
-<span class="n">c</span><span class="o">.</span><span class="n">frame</span><span class="o">.</span><span class="n">menu</span><span class="o">.</span><span class="n">createMenuItemsFromTable</span><span class="p">(</span><span class="s">&#39;File&#39;</span><span class="p">,</span><span class="n">table</span><span class="p">)</span>
-</pre></div>
-</div>
-<p>Plugins can do anything with menus using c.frame.menu.getMenu. For example, here
-is a script that adds a Test menu item after the &#8216;Open With&#8217; menu item in the
-File menu:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">callback</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span><span class="o">**</span><span class="n">keys</span><span class="p">):</span>
-    <span class="n">g</span><span class="o">.</span><span class="n">trace</span><span class="p">()</span>
-
-<span class="n">fileMenu</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">frame</span><span class="o">.</span><span class="n">menu</span><span class="o">.</span><span class="n">getMenu</span><span class="p">(</span><span class="s">&#39;File&#39;</span><span class="p">)</span>
-
-<span class="c"># 3 is the position in the menu.  Other kinds of indices are possible.</span>
-<span class="n">fileMenu</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span><span class="s">&#39;command&#39;</span><span class="p">,</span><span class="n">label</span><span class="o">=</span><span class="s">&#39;Test2&#39;</span><span class="p">,</span><span class="n">command</span><span class="o">=</span><span class="n">callback</span><span class="p">)</span>
-</pre></div>
-</div>
-</div>
-<div class="section" id="how-can-i-use-leo-s-legacy-key-bindings">
-<h3><a class="toc-backref" href="#id37">How can I use Leo&#8217;s legacy key bindings?</a><a class="headerlink" href="#how-can-i-use-leo-s-legacy-key-bindings" title="Permalink to this headline">¶</a></h3>
-<p>You can &#8216;revert&#8217; to old key bindings as follows:</p>
-<ol class="arabic simple">
-<li>Open leoSettings.leo.</li>
-<li>Find the node &#8216;Keyboard shortcuts&#8217;.</li>
-<li>Disable the old bindings by moving the node
-<a class="reference external" href="mailto:'&#37;&#52;&#48;keys">'<span>&#64;</span>keys</a> EKR bindings: Emacs keys + modes&#8217;
-so that it is a child of the node:
-<a class="reference external" href="mailto:'&#37;&#52;&#48;ignore">'<span>&#64;</span>ignore</a> Unused key bindings&#8217;.</li>
-<li>Notice that there are two child nodes of the node
-<a class="reference external" href="mailto:'&#37;&#52;&#48;ignore">'<span>&#64;</span>ignore</a> Unused key bindings&#8217;
-that refer to legacy key bindings:<ul>
-<li><a class="reference external" href="mailto:'&#37;&#52;&#48;keys">'<span>&#64;</span>keys</a> Legacy Leo shortcuts with important Emacs bindings&#8217;</li>
-<li><a class="reference external" href="mailto:'&#37;&#52;&#48;keys">'<span>&#64;</span>keys</a> Legacy Leo bindings&#8217;.</li>
-</ul>
-</li>
-<li>Move <strong>one</strong> of these two legacy nodes up one level so that it is a child of the node
-&#8216;Keyboard shortcuts&#8217;.
-It should <strong>not</strong> be a child of the node
-<a class="reference external" href="mailto:'&#37;&#52;&#48;ignore">'<span>&#64;</span>ignore</a> Unused key bindings&#8217;.</li>
-</ol>
-</div>
-<div class="section" id="how-can-i-enable-and-disable-support-for-psyco">
-<h3><a class="toc-backref" href="#id38">How can I enable and disable support for psyco?</a><a class="headerlink" href="#how-can-i-enable-and-disable-support-for-psyco" title="Permalink to this headline">¶</a></h3>
-<p>Find the &#64;file leoApp.py node in leoPy.leo.
-In the ctor for the LeoApp class set self.use_psyco to True or False.
-You will find this ctor in the node:</p>
-<div class="highlight-python"><pre>Code--&gt;Core classes...--&gt;@file leoApp.py--&gt;app.__init__</pre>
-</div>
-<p>Note that this ivar can not be set using settings in leoSettings.leo because
-Leo uses g.app.use_psyco before processing configuration settings.</p>
-</div>
-<div class="section" id="how-do-i-specify-qt-fonts">
-<h3><a class="toc-backref" href="#id39">How do I specify qt fonts?</a><a class="headerlink" href="#how-do-i-specify-qt-fonts" title="Permalink to this headline">¶</a></h3>
-<p>When using the Qt gui, you specify fonts
-using the node in leoSettings.leo called:</p>
-<div class="highlight-python"><pre>@data qt-gui-plugin-style-sheet</pre>
-</div>
-<p>As usual, you will probably want to put this node in your myLeoSettings.leo file.</p>
-</div>
-<div class="section" id="how-do-i-set-selection-colors">
-<h3><a class="toc-backref" href="#id40">How do I set selection colors?</a><a class="headerlink" href="#how-do-i-set-selection-colors" title="Permalink to this headline">¶</a></h3>
-<p>You set selection colors in the following settings node:</p>
-<div class="highlight-python"><pre>@data qt-gui-plugin-style-sheet</pre>
-</div>
-<p>After further reflection, there does not seem to be much that can be done.</p>
-<p>Suppose, for example, that Leo converts an &#64;setting node to a mini
-stylesheet.  (In fact, Leo sometimes does do this, in other contexts.)</p>
-<blockquote>
-We now have a conundrum: which should take precedence: the &#64;data</blockquote>
-<p>qt-gui-plugin-style-sheet setting or the &#64;color
-body_text_selection_foreground_color setting?</p>
-<p>Rather than open that can of worms, the best solution seems to be to
-declare that yes, some settings <em>are</em> gui dependent.  Use &#64;data
-qt-gui-plugin-style-sheet to set those settings.</p>
-</div>
-</div>
-<div class="section" id="tips-and-techniques">
-<h2><a class="toc-backref" href="#id41">Tips and techniques</a><a class="headerlink" href="#tips-and-techniques" title="Permalink to this headline">¶</a></h2>
-<div class="section" id="what-is-an-easy-way-to-profile-code">
-<h3><a class="toc-backref" href="#id42">What is an easy way to profile code?</a><a class="headerlink" href="#what-is-an-easy-way-to-profile-code" title="Permalink to this headline">¶</a></h3>
-<p>I had a need to figure out why a part of some python code I had written
-was taking too long.</p>
-<p>I pulled the code into LEO and the relevant part of the outline looked
-something like this:</p>
-<div class="highlight-python"><pre>+ Main module
--- Generate cryptographic key
--- Hashing algorithm</pre>
-</div>
-<p>etc. So I cloned just the segment I wanted to profile and pulled it under a new
-section:</p>
-<div class="highlight-python"><pre>+ Main module
--- [clone] Generate cryptographic key
--- Hashing algorithm
-
-+ Profiling Experiment
--- [clone] Generate cryptographic key</pre>
-</div>
-<p>And in the body of the &#8220;Profiling experiment&#8221;, I used this code:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">code_under_here</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;</span>
-<span class="s">@others</span>
-<span class="s">&quot;&quot;&quot;</span>
-
-<span class="kn">from</span> <span class="nn">timeit</span> <span class="kn">import</span> <span class="n">Timer</span>
-<span class="n">t</span> <span class="o">=</span> <span class="n">Timer</span><span class="p">(</span><span class="s">&quot;print my_key_generator()&quot;</span><span class="p">,</span> <span class="n">code_under_here</span><span class="p">)</span>
-<span class="k">print</span> <span class="n">t</span><span class="o">.</span><span class="n">timeit</span><span class="p">(</span><span class="n">number</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span>
-</pre></div>
-</div>
-<p>And then I hit Control-B to execute the Profiling Experiment body. This
-let me make adjustments to the code in the clone body and keep hitting
-Control-B to execute the code with the timeit module to see immediately
-if what I had done was making a difference.</p>
-<p>The great thing about this was that I just used the LEO &#64;others construct
-to create a wrapper around the code and did not need to litter my code
-with debug or profiling statements.  &#8211; Kayvan</p>
-</div>
-<div class="section" id="how-can-i-do-a-simple-find-and-replace">
-<h3><a class="toc-backref" href="#id43">How can I do a simple find and replace?</a><a class="headerlink" href="#how-can-i-do-a-simple-find-and-replace" title="Permalink to this headline">¶</a></h3>
-<p>The &#8216;official&#8217; way to start a replace command is:</p>
-<div class="highlight-python"><pre>&lt;Ctrl-shift-r&gt;find-pattern&lt;return&gt;replace-text&lt;return&gt;</pre>
-</div>
-<p>But suppose you with start with:</p>
-<div class="highlight-python"><pre>&lt;ctrl-f&gt;find-pattern</pre>
-</div>
-<p>and then realize you want to do a replace instead of a find.
-No problem.  The following also works:</p>
-<div class="highlight-python"><pre>&lt;Ctrl-f&gt;find-pattern&lt;Ctrl-shift-r&gt;replace-text&lt;return&gt;</pre>
-</div>
-<p>In other words, you can think of <cite>&lt;ctrl-f&gt;</cite> as meaning &#8216;show the find dialog&#8217;.
-There is another trick you should know.
-After typing <cite>&lt;ctrl-f&gt;</cite> or <cite>&lt;shift-ctrl-r&gt;</cite> you can use <cite>&lt;alt-ctrl&gt;</cite> keys to set or clear find options.
-For example:</p>
-<div class="highlight-python"><pre>&lt;ctrl-f&gt;&lt;alt-ctrl-w&gt;&lt;find-pattern&gt;&lt;return&gt;</pre>
-</div>
-<p>That is, <cite>&lt;ctrl-f&gt;`shows the find dialog,
-`&lt;alt-ctrl-w&gt;</cite> toggles the Whole Word checkbox and
-<cite>&lt;return&gt;</cite> starts the search.
-You can type the <cite>&lt;alt-ctrl&gt;</cite> keys anytime after <cite>&lt;ctrl-f&gt;</cite> (or <cite>&lt;shift-ctrl-r&gt;</cite>) and before <cite>&lt;return&gt;</cite>.
-You can also type multiple <cite>&lt;alt-ctrl-keys&gt;</cite> to toggle multiple checkboxes.</p>
-</div>
-<div class="section" id="how-can-i-use-leo-to-develop-leo-itself">
-<h3><a class="toc-backref" href="#id44">How can I use Leo to develop Leo itself?</a><a class="headerlink" href="#how-can-i-use-leo-to-develop-leo-itself" title="Permalink to this headline">¶</a></h3>
-<p>The trick is to create a workflow that separates editing from testing. Putting
-test code in LeoPy.leo would waste a lot of time. To run tests you would
-have to exit Leo and reload LeoPy.leo. A much quicker way is to put all test
-code in a test.leo file. So to change and test code, do the following:</p>
-<ol class="arabic simple">
-<li>Save LeoPy.leo but do <strong>not</strong> exit Leo.</li>
-<li>Quit the copy of Leo running test.leo, then reload test.leo.</li>
-<li>Run test scripts from test.leo.</li>
-</ol>
-<p>That&#8217;s all. Python will recompile any changed .py files in the new copy of Leo.
-<strong>Note</strong>: I create a batch file called t.bat that runs test.leo, so to the
-&#8220;edit-reload-test&#8221; cycle is just:</p>
-<ol class="arabic simple">
-<li>Control-S (in LeoPy.leo: saves the .leo file)</li>
-<li>t         (in a console window: runs test.leo, compiling all changed .py files as a side effect)</li>
-<li>Control-E (in test.leo: runs the test script)</li>
-</ol>
-<p>The benefits of the new workflow:</p>
-<ul class="simple">
-<li>test.leo loads  _much_ more quickly than LeoPy.leo does.
-This new approach can increase the speed of the edit-reload-test cycle by more than a factor of 10.
-Hitting Control-S, t, Control-E takes about 5 seconds.</li>
-<li>LeoPy.leo runs with the <em>old</em> code,
-so it is much easier to fix syntax errors or exceptions in the <em>new</em> code:
-just fix the problem and save LeoPy.leo <em>without</em> closing LeoPy.leo,
-then restart test.leo.
-You run your tests on the new code, but you edit the new code with the old, stable code.</li>
-<li>test.leo is the perfect place to develop test.
-I can create and organize those tests and when I am done, &#8216;&#8217;test.leo&#8217;&#8217; is a log of my work.</li>
-</ul>
-</div>
-<div class="section" id="how-can-i-import-many-files-at-once">
-<h3><a class="toc-backref" href="#id45">How can I import many files at once?</a><a class="headerlink" href="#how-can-i-import-many-files-at-once" title="Permalink to this headline">¶</a></h3>
-<p>The Import Files dialog allows you to select multiple files provided you are running Python 2.3 or above.
-There is also an importFiles script in LeoPy.leo.  You can use that script as follows:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">leo.core.leoImport</span> <span class="kn">as</span> <span class="nn">leoImport</span>
-<span class="n">leoImport</span><span class="o">.</span><span class="n">importFiles</span><span class="p">(</span><span class="n">aDirectory</span><span class="p">,</span> <span class="s">&quot;.py&quot;</span><span class="p">)</span>
-</pre></div>
-</div>
-<p>This will import all .py files from aDirectory, which should be a full path to a particular directory.
-You could use &#8221;.c&#8221; to import all .c files, etc.</p>
-</div>
-<div class="section" id="how-can-i-use-two-copies-of-leo-to-advantage">
-<h3><a class="toc-backref" href="#id46">How can I use two copies of Leo to advantage?</a><a class="headerlink" href="#how-can-i-use-two-copies-of-leo-to-advantage" title="Permalink to this headline">¶</a></h3>
-<p>By Rich Ries.
-I often rework C code that&#8217;s already been &#8220;Leo-ized&#8221;&#8211;the first pass was quick
-and dirty to get it going. When I do subsequent passes, I wind up with subnodes
-that are out of order with the sequence found in the main <a class="reference external" href="glossary.html#node">node</a>. It&#8217;s not a big
-deal, but I like &#8216;em ordered. With just one editor pane, clicking on the <a class="reference external" href="glossary.html#node">node</a> to
-move would switch focus to that <a class="reference external" href="glossary.html#node">node</a>. I&#8217;d then need to re-focus on the main
-<a class="reference external" href="glossary.html#node">node</a>. A minor nuisance, but it does slow you down.</p>
-<p>My solution is to open a second editor with its focus on the main <a class="reference external" href="glossary.html#node">node</a>. Switch
-to the other editor, and, referring to the first editor pane, move the nodes as
-you like. The second editor&#8217;s pane will change focus to the <a class="reference external" href="glossary.html#node">node</a> you&#8217;re moving,
-but the first editor will stay focused on the main <a class="reference external" href="glossary.html#node">node</a>. It&#8217;s a lot easier to
-do than to describe!</p>
-</div>
-<div class="section" id="how-can-i-display-graphics-in-leo">
-<h3><a class="toc-backref" href="#id47">How can I display graphics in Leo?</a><a class="headerlink" href="#how-can-i-display-graphics-in-leo" title="Permalink to this headline">¶</a></h3>
-<p>One way is to link directly to the media file from a Leo <a class="reference external" href="glossary.html#node">node</a> (with &#64;url)
-and write a script button to wrap all URL-nodes under the current <a class="reference external" href="glossary.html#node">node</a> in a
-single HTML page (using the HTML browser trick at
-<a class="reference external" href="http://sourceforge.net/forum/forum.php?thread_id=1201579&amp;forum_id=10226">http://sourceforge.net/forum/forum.php?thread_id=1201579&amp;forum_id=10226</a>).</p>
-<p>Then, you can view your media in two ways:</p>
-<ul class="simple">
-<li>Individually. You can directly click on the &#64;url link to display the media
-in the browser (assuming you have your MIME/filetype associations set up
-correctly for your browser).</li>
-<li>In a group. You can click on a script button (you have to code this yourself,
-very simple) which should collect all &#64;url <a class="reference external" href="glossary.html#nodes">nodes</a> under the current <a class="reference external" href="glossary.html#node">node</a>
-and dynamically generate a HTML page displaying either links to or embedded
-versions of the media (using the HTML trick described above to invoke the
-browser). This way, you can create collections of &#64;url nodes under a
-single <a class="reference external" href="glossary.html#node">node</a> (like a bookmark folder), and press a single button to view the
-&#64;url collection as a single entity in the browser (with all browser
-capabilities like displaying the media).</li>
-</ul>
-<p>You could probably generalize this idea of &#8220;collect all &#64;url nodes under current
-<a class="reference external" href="glossary.html#node">node</a> and display as HTML in browser&#8221; into a general-purpose plugin. However,
-the plugin would have to be somewhat smart in mapping a link to its corresponding
-HTML code (e.g. an image link gets mapped to an &lt;img&gt; HTML tag, a link to a
-Flash file gets mapped to an &lt;embed&gt; tag, etc).</p>
-</div>
-<div class="section" id="how-can-i-create-a-template-leo-file">
-<h3><a class="toc-backref" href="#id48">How can I create a template .leo file?</a><a class="headerlink" href="#how-can-i-create-a-template-leo-file" title="Permalink to this headline">¶</a></h3>
-<p><strong>Question</strong>:
-It would be nice if Leo could open empty files. I tend to be &#8220;document oriented&#8221;
-rather than &#8220;application oriented&#8221; in my thinking and prefer &#8220;create empty file
-at location -&gt; open it with program&#8221; to &#8220;start program -&gt; create new file -&gt;
-save it at location&#8221;.</p>
-<p><strong>Answer</strong> by Paul Paterson:
-If you are on Windows 98/2000/XP then the procedure is as follows...</p>
-<ol class="arabic simple">
-<li>Start Leo</li>
-<li>Click New</li>
-<li>Click Save as...</li>
-<li>Save the file as &#8220;c:\windows\shellnew\leofile.leo&#8221; (or c:\winnt for 2000/XP)</li>
-<li>Open regedit &#8220;start...run...regedit&#8221;</li>
-<li>Open HKEY_CLASSES_ROOT and find the &#8221;.leo&#8221; extension type</li>
-<li>Go New ... Key from the context menu</li>
-<li>Call the new key ShellNew</li>
-<li>Select the new key, right-click, choose New...String Value from the context menu</li>
-<li>Call it FileName</li>
-<li>Double-click on the string, and modify it to be the filename of the leofile.leo file you created,
-including the extension</li>
-<li>Exit the registry editor and restart Windows Explorer (you may need to reboot on Windows 98)</li>
-</ol>
-<p>Now you should have a New:Leo File option in Explorer. This creates a duplicate
-of the file you saved. This can be useful because you could make a template Leo
-file containing some standard <a class="reference external" href="glossary.html#nodes">nodes</a> that you always have and then save this.</p>
-</div>
-<div class="section" id="how-can-i-show-leo-files-with-excel">
-<h3><a class="toc-backref" href="#id49">How can I show Leo files with Excel?</a><a class="headerlink" href="#how-can-i-show-leo-files-with-excel" title="Permalink to this headline">¶</a></h3>
-<p>From: <a class="reference external" href="http://sourceforge.net/forum/message.php?msg_id=3240374">http://sourceforge.net/forum/message.php?msg_id=3240374</a>
-Using Leo&#8217;s File-Export-Flatten Outline commands creates a MORE style outline which places
-all Leo body sections on the left margin.
-The <a class="reference external" href="glossary.html#headlines">headlines</a> are indented with tabs which Excel will read as a tab delimited format.
-Once inside Excel there are benefits.</p>
-<ol class="arabic">
-<li><p class="first">The most obvious benefit inside Excel is that the body sections (Excel first
-column) can be selected easily and highlighted with a different font color.
-This makes the MORE format very readable. Save a copy of your sheet as HTML
-and now you have a web page with the body sections highlighted.</p>
-</li>
-<li><p class="first">It is possible to hide columns in Excel.
-Hiding the first column leaves just the headlines showing.</p>
-</li>
-<li><p class="first">Formulas based on searching for a string can do calculations in Excel.
-For example if a heading &#8220;Current Assets&#8221; appears on level 4 then the body formula:</p>
-<div class="highlight-python"><pre>=INDEX(A:A,MATCH("Current Assets",D:D,0)+1)</pre>
-</div>
-<p>will retrieve it. The +1 after match looks down one row below the matched
-headline. The trick is to place all your headlines in quotes because Excel
-will see + &#8220;Current Assets&#8221; from the MORE outline. When Excel tries
-without the quotes it thinks it is a range name and displays a #N/A
-error instead of the headline. Also you must place a child <a class="reference external" href="glossary.html#node">node</a> below to
-get the + sign instead of a - sign which would give a MORE headline of
--&#8220;Current assets&#8221; , also is an error.</p>
-</li>
-</ol>
-<p>I think there is some interesting possibility here because of the enforcement of
-Leo body text being always in the first column. The Leo outline provides
-additional reference to organizing the problem not typical of spreadsheet
-models. Beyond scripting in Python, Excel is good at doing interrelated
-calculations and detecting problems like circular references. In Excel
-Tools-Options-General is a setting for r1c1 format which then shows numbers
-instead of letters for column references. Using this would allow entries like
-this in the leo body:</p>
-<div class="highlight-python"><pre>1000
-3500
-=R[-1]C+R[-2]C</pre>
-</div>
-<p>In Excel you would see 4500 below those two numbers. This is completely
-independent of where the block of three cells exists on the sheet.</p>
-</div>
-<div class="section" id="how-can-i-reuse-button-nodes-in-multiple-files">
-<h3><a class="toc-backref" href="#id50">How can I reuse &#64;button nodes in multiple files?</a><a class="headerlink" href="#how-can-i-reuse-button-nodes-in-multiple-files" title="Permalink to this headline">¶</a></h3>
-<p>By Rich Ries</p>
-<p>There is no direct way to make script buttons available in multiple Leo files.
-Sure, you could copy and paste the &#64;button nodes, but there is a slightly
-easier way using the &#8220;New Buttons&#8221; plugin.</p>
-<ol class="arabic simple">
-<li>Create and test and debug your desired Script Button.</li>
-<li>With the Script Button node selected, run Plugins &#8211;&gt; New buttons &#8211;&gt; Make Template From</li>
-</ol>
-<p>Open a new Leo file.</p>
-<ol class="arabic simple" start="3">
-<li>Assuming you have only the one New Button Template defined, left-click the
-New button, and a new node will be added to your outline. (Otherwise, you&#8217;ll
-need to select the Template you want.)</li>
-<li>Press [Script Button] to create the new script button.</li>
-</ol>
-<p>It&#8217;s easier to <em>do</em> this than to <em>explain</em> it!</p>
-</div>
-</div>
-<div class="section" id="trouble-shooting">
-<h2><a class="toc-backref" href="#id51">Trouble shooting</a><a class="headerlink" href="#trouble-shooting" title="Permalink to this headline">¶</a></h2>
-<div class="section" id="how-do-i-get-help">
-<h3><a class="toc-backref" href="#id52">How do I get help?</a><a class="headerlink" href="#how-do-i-get-help" title="Permalink to this headline">¶</a></h3>
-<p>All questions are welcome at <a class="reference external" href="http://groups.google.com/group/leo-editor">http://groups.google.com/group/leo-editor</a></p>
-</div>
-<div class="section" id="how-do-i-report-bugs">
-<h3><a class="toc-backref" href="#id53">How do I report bugs?</a><a class="headerlink" href="#how-do-i-report-bugs" title="Permalink to this headline">¶</a></h3>
-<p>You can discuss possible bugs at
-<a class="reference external" href="http://groups.google.com/group/leo-editor">http://groups.google.com/group/leo-editor</a></p>
-<p>Please report bugs at
-<a class="reference external" href="http://bugs.launchpad.net/leo-editor">http://bugs.launchpad.net/leo-editor</a></p>
-<p>When reporting a bug, please include <em>all</em> of the following:</p>
-<ul class="simple">
-<li>The version of Leo used.</li>
-<li>The version of Python used.</li>
-<li>The platform or platforms used: Linux, Windows, MacOS.</li>
-<li>A clear description of the problem.</li>
-<li>Information sufficient to recreate the problem.</li>
-</ul>
-<p>It&#8217;s polite to make the bug report self contained, so that six weeks later
-somebody will be able to understand the report as it stands.</p>
-</div>
-<div class="section" id="my-old-leo-files-won-t-load-using-leo-4-5-or-later-what-should-i-do">
-<h3><a class="toc-backref" href="#id54">My old .leo files won&#8217;t load using Leo 4.5 or later. What should I do?</a><a class="headerlink" href="#my-old-leo-files-won-t-load-using-leo-4-5-or-later-what-should-i-do" title="Permalink to this headline">¶</a></h3>
-<p>In version 4.5, Leo changed to using a sax parser for .leo files. This can cause
-problems if your .leo file contains invalid characters.
-Bugs in previous versions of Leo permitted these bad characters to appear.</p>
-<p>The sax parser complains that these characters are not valid in .xml files.
-Remove these invalid characters as follows:</p>
-<ol class="arabic">
-<li><p class="first"><a class="reference external" href="installing.html#running-leo-from-a-console-window">run Leo in a console window</a>, and load the .leo file.
-Near the bottom of the error message you will see a line like:</p>
-<div class="highlight-python"><pre>SAXParseException: &lt;unknown&gt;:123:25: not well-formed (invalid token)</pre>
-</div>
-<p>This line reports a bad character at character 25 of line 123.</p>
-</li>
-<li><p class="first">Open the .leo file in an external editor.
-The Scite editor, <a class="reference external" href="http://www.scintilla.org/SciTE.html">http://www.scintilla.org/SciTE.html</a>,
-is a good choice because it clearly shows non-printing characters.
-Remove the invalid character, save the .leo file.</p>
-</li>
-</ol>
-<p>Repeat steps 1 and 2 until all invalid characters are gone.</p>
-</div>
-<div class="section" id="error-messages-from-the-rst3-plugin-aren-t-helpful-what-can-i-do">
-<h3><a class="toc-backref" href="#id55">Error messages from the rst3 plugin aren&#8217;t helpful. What can I do?</a><a class="headerlink" href="#error-messages-from-the-rst3-plugin-aren-t-helpful-what-can-i-do" title="Permalink to this headline">¶</a></h3>
-<p>For the most part, <a class="reference external" href="http://docutils.sourceforge.net/">docutils</a> does a good job of reporting errors. <a class="reference external" href="http://docutils.sourceforge.net/">docutils</a> prints
-a message to the console and inserts an unmistakable error message in the
-generated .html file.
-<strong>Important</strong>: On Windows it is helpful to <a class="reference external" href="installing.html#running-leo-from-a-console-window">run Leo in a console window</a>.</p>
-<p>However, in some cases, <a class="reference external" href="http://docutils.sourceforge.net/">docutils</a> crashes instead of properly reporting the
-problem. There are several workarounds:</p>
-<ol class="arabic">
-<li><p class="first">The crashes I have seen arise from the following bug in docutils.
-<strong>Hyperlinks in image:: markup must be lower case</strong>.  This will work:</p>
-<div class="highlight-python"><pre>.. .. |back| image:: arrow_lt.gif
-    :target: faq_</pre>
-</div>
-<p>This will <strong>crash</strong>:</p>
-<div class="highlight-python"><pre>.. .. |back| image:: arrow_lt.gif
-    :target: FAQ_</pre>
-</div>
-<p>So avoid this crash by making sure to use lower case targets in &#8216;:target:&#8217; markup.</p>
-</li>
-<li><p class="first">You can change the <a class="reference external" href="http://docutils.sourceforge.net/">docutils</a> source slightly so that it prints a traceback when it
-crashes. (The rst3 plugin should be able to do this, but I haven&#8217;t figured
-out how yet.) It&#8217;s easy enough to do this:</p>
-<ul>
-<li><p class="first">Find the file core.py in top-level docutils folder.
-Typically this folder will be in Python&#8217;s site-packages folder.</p>
-</li>
-<li><p class="first">Open core.py in some editor other than Leo.</p>
-</li>
-<li><p class="first">Find the method called report_Exceptions.</p>
-</li>
-<li><p class="first">Insert the following lines at the very start of this method:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="k">print</span> <span class="s">&#39;EKR: added traceback&#39;</span>
-<span class="kn">import</span> <span class="nn">traceback</span> <span class="p">;</span> <span class="n">traceback</span><span class="o">.</span><span class="n">print_exc</span><span class="p">()</span>
-</pre></div>
-</div>
-</li>
-</ul>
-<p>This will cause a traceback whenever <a class="reference external" href="http://docutils.sourceforge.net/">docutils</a> crashes. I have found that
-such tracebacks are generally enough to locate the general area of the
-problem. <strong>Note</strong>: These tracebacks go to the console window, so you should
-<a class="reference external" href="installing.html#running-leo-from-a-console-window">run Leo in a console window</a>.</p>
-</li>
-<li><p class="first">As a last resort, you can isolate syntax errors by reducing your input files
-until they work again, then adding sections until you get a crash. This is
-easy enough to do (when using the rst3 plugin) by change a headline &#8216;x&#8217; to
-&#64;rst-ignore-tree x.</p>
-</li>
-</ol>
-</div>
-<div class="section" id="how-can-i-run-leo-from-a-console-window">
-<h3><a class="toc-backref" href="#id56">How can I run Leo from a console window?</a><a class="headerlink" href="#how-can-i-run-leo-from-a-console-window" title="Permalink to this headline">¶</a></h3>
-<p>Leo (and other programs) often send more detailed error messages to stderr,
-the output stream that goes to the console window. In Linux and MacOS
-environments, python programs normally execute with the console window visible.
-On Windows, can run Leo with the console window visible by associating .leo
-files with python.exe <em>not</em> pythonw.exe.</p>
-</div>
-<div class="section" id="how-can-i-use-python-s-pdb-debugger-with-leo">
-<h3><a class="toc-backref" href="#id57">How can I use Python&#8217;s pdb debugger with Leo?</a><a class="headerlink" href="#how-can-i-use-python-s-pdb-debugger-with-leo" title="Permalink to this headline">¶</a></h3>
-<p>Just <a class="reference external" href="installing.html#running-leo-from-a-console-window">run Leo in a console window</a>. At the point you want to drop into the
-debugger, execute this line:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">g</span><span class="o">.</span><span class="n">pdb</span><span class="p">()</span>
-</pre></div>
-</div>
-<p>All output from pdb goes to stdout, which is the console window. It would be
-good to create a subclass of pdb.Pdb that uses Leo&#8217;s log pane rather than a
-console window, but I haven&#8217;t done that. It could be done easily enough in a
-plugin...</p>
-<p><strong>Important</strong>: I recommend using g.trace instead of pdb.  For example:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">g</span><span class="o">.</span><span class="n">trace</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
-</pre></div>
-</div>
-<p>prints the name of the function or method containing the trace, and the value of
-x. g.callers is often useful in combination with g.trace. g.callers(5)
-returns the last 5 entries of the call stack. For example:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">g</span><span class="o">.</span><span class="n">trace</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">g</span><span class="o">.</span><span class="n">callers</span><span class="p">(</span><span class="mi">5</span><span class="p">))</span>
-</pre></div>
-</div>
-<p>Used this way, g.trace shows you patterns that will be invisible using pdb.</p>
-</div>
-<div class="section" id="i-can-t-write-imported-files-what-s-going-on">
-<h3><a class="toc-backref" href="#id58">I can&#8217;t write Imported files.  What&#8217;s going on?</a><a class="headerlink" href="#i-can-t-write-imported-files-what-s-going-on" title="Permalink to this headline">¶</a></h3>
-<p>The import commands insert &#64;ignore <a class="reference external" href="glossary.html#directives">directives</a> in the top-level <a class="reference external" href="glossary.html#node">node</a>.
-Leo does this so that you won&#8217;t accidentally overwrite your files after importing them.
-Change the filename following &#64;file (or &#64;file) as desired,
-then remove the &#64;ignore <a class="reference external" href="glossary.html#directive">directive</a>.
-Saving the outline will then create the external file.</p>
-</div>
-<div class="section" id="leo-s-recent-files-menu-doesn-t-work-from-a-cvs-shandbox-what-s-going-on">
-<h3><a class="toc-backref" href="#id59">Leo&#8217;s Recent Files menu doesn&#8217;t work from a cvs shandbox.  What&#8217;s going on?</a><a class="headerlink" href="#leo-s-recent-files-menu-doesn-t-work-from-a-cvs-shandbox-what-s-going-on" title="Permalink to this headline">¶</a></h3>
-<p>You must create .leoRecentFiles.txt in the config directory.
-.leoRecentFiles.txt is part of the standard releases but is not part of the cvs repository.</p>
-</div>
-<div class="section" id="id1">
-<h3><a class="toc-backref" href="#id60">Nothing (or almost nothing) happens when I start Leo.  What should I do?</a><a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
-<p>Missing modules can cause installation problems.
-If the installer doesn&#8217;t work (or puts up a dialog containing no text), you may install Leo from the .zip file
-as described at <a class="reference external" href="installing.html#how-to-install-leo-on-windows">How to install Leo on Windows</a>.
-However you are installing Leo,
-be sure to <a class="reference external" href="installing.html#running-leo-from-a-console-window">run Leo in a console window</a>.
-because as a last resort Leo prints error messages to the console.</p>
-</div>
-<div class="section" id="the-new-python-decorator-syntax-causes-problems-what-can-i-do">
-<h3><a class="toc-backref" href="#id61">The new Python decorator syntax causes problems.  What can I do?</a><a class="headerlink" href="#the-new-python-decorator-syntax-causes-problems-what-can-i-do" title="Permalink to this headline">¶</a></h3>
-<p>Python&#8217;s <a class="reference external" href="http://www.python.org/peps/pep-0318.html">decorator</a> syntax is ill-conceived.
-This syntax file hack works well enough anyway to work with Leo &#8216;&#64;&#8217; markup:</p>
-<div class="highlight-python"><pre>syn region leoComment start="^@\\s*" end="^@c\\s*$"
-syn match   pythonDecorator "@\\S\\S+" display nextgroup=pythonFunction skipwhite</pre>
-</div>
-</div>
-<div class="section" id="id2">
-<h3><a class="toc-backref" href="#id62">Running Python setup.py install from the leo directory doesn&#8217;t work.  Why not?</a><a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
-<p>Leo&#8217;s setup.py script is intended only to create source distributions. It can&#8217;t
-be used to install Leo because Leo is not a Python package.</p>
-</div>
-<div class="section" id="i-can-t-run-the-leobridge-module-outside-of-leo-core-what-should-i-do">
-<h3><a class="toc-backref" href="#id63">I can&#8217;t run the LeoBridge module outside of leo/core.  What should I do?</a><a class="headerlink" href="#i-can-t-run-the-leobridge-module-outside-of-leo-core-what-should-i-do" title="Permalink to this headline">¶</a></h3>
-<p>Question and answer from plumloco.</p>
-<p>Add the equivalent of:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span>
-<span class="n">leocore</span> <span class="o">=</span> <span class="s">&quot;path/to/leo/core&quot;</span>
-<span class="k">if</span> <span class="n">leocore</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="p">:</span> <span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">leocore</span><span class="p">)</span>
-<span class="kn">import</span> <span class="nn">leo.core.leoBridge</span> <span class="kn">as</span> <span class="nn">leoBridge</span>
-</pre></div>
-</div>
-<p>at the head of each file that uses leoBridge.</p>
-<p>The problem is not importing leoBridge itself but (if I use &#8216;from leo.core&#8217;) the
-importing of plugins, who get a different leoGlobals from leoBridge, without
-g.app etc, and so do not work if they rely on dynamic values in g.etc.</p>
-<p>&gt; Why can&#8217;t you simply add leo/core to sys.path in sitecustomize.py?</p>
-<p>Putting leo/core on the python path as you suggest would put forty python modules
-in the global module namespace for all python programs when I want just one.
-Also, I have a safe working copy of leo and a cvs/testing version. I would wish
-to test any programs against the testing version while using the working
-version, but both /core directories can&#8217;t be exposed at the same time.</p>
-<p>&gt; Do you need plugins while running from the leoBridge?</p>
-<p>Afraid so, at least the rst3 plugin. The solution I am using now is to place:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">sys</span><span class="o">.</span><span class="n">modules</span><span class="p">[</span><span class="s">&#39;leoGlobals&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">leoGlobals</span>
-</pre></div>
-</div>
-<p>in leoBridge after import leo.core.leoGlobals as leoGlobals</p>
-<p>This allows my scripts
-to be portable over the several computers/platforms I need to use them on, and
-makes testing scripts against multiple leo versions easy. It does mean that my
-scripts are not portable to other leo users but that is not likely to be a
-problem.</p>
-</div>
-<div class="section" id="why-didn-t-leo-update-my-shadow-outline-as-expected">
-<h3><a class="toc-backref" href="#id64">Why didn&#8217;t Leo update my &#64;shadow outline as expected?</a><a class="headerlink" href="#why-didn-t-leo-update-my-shadow-outline-as-expected" title="Permalink to this headline">¶</a></h3>
-<p>As explained <a class="reference external" href="atShadow.html#aha-boundary-cases-don-t-matter">here</a>, the fundamental &#64;shadow algorithm guarantees <em>only</em> that
-writing an updated &#64;shadow outline will generate the updated <strong>public</strong> file.
-There is <em>no way</em> to guarantee that the updated outline structure will be as
-expected. The &#64;shadow algorithm can not <em>in principle</em> guess between two or
-more ways of updating the <strong>private</strong> file when each of the ways yields the same
-<strong>public</strong> file.</p>
-<p>Happily, this &#8220;fact of life&#8221; about &#64;shadow is not serious. If you don&#8217;t like
-the &#8220;guesses&#8221; that the &#64;shadow algorithm has made, you can simply change the
-&#64;shadow tree. After saving the outline, the <em>private</em> file will record your
-choice. The next time you open the outline, you will see the choices <em>you</em> made,
-not the guesses that the &#64;shadow algorithm made.</p>
-</div>
-</div>
-<div class="section" id="unicode-issues">
-<h2><a class="toc-backref" href="#id65">Unicode issues</a><a class="headerlink" href="#unicode-issues" title="Permalink to this headline">¶</a></h2>
-<div class="section" id="i-can-not-enter-non-ascii-characters-what-can-i-do">
-<h3><a class="toc-backref" href="#id66">I can not enter non-ascii characters.  What can I do?</a><a class="headerlink" href="#i-can-not-enter-non-ascii-characters-what-can-i-do" title="Permalink to this headline">¶</a></h3>
-<p>Set &#64;bool ignore_unbound_non_ascii_keys = False in LeoSettings.leo or myLeoSettings.leo.</p>
-</div>
-<div class="section" id="some-characters-in-external-files-look-funny-what-can-i-do">
-<h3><a class="toc-backref" href="#id67">Some characters in external files look funny. What can I do?</a><a class="headerlink" href="#some-characters-in-external-files-look-funny-what-can-i-do" title="Permalink to this headline">¶</a></h3>
-<p>Internally, Leo represents all strings as unicode. Leo translates from a
-particular encoding to <a class="reference external" href="http://www.unicode.org/">Unicode</a> when reading .leo files or external files. Leo
-translates from <a class="reference external" href="http://www.unicode.org/">Unicode</a> to a particular encoding when writing external files.
-You may see strange looking characters if your text editor is expecting a
-different encoding. The encoding used in any external file is shown in the
-<a class="reference external" href="mailto:#&#37;&#52;&#48;+leo">#<span>&#64;</span>+leo</a> sentinel line like this:</p>
-<div class="highlight-python"><pre>#@+leo-encoding=iso-8859-1.</pre>
-</div>
-<p><strong>Exception</strong>: the encoding is UTF-8 if no -encoding= field exists.
-You can also use the &#64;encoding <a class="reference external" href="glossary.html#directive">directive</a> to set the encoding for individual external files.
-If no &#64;encoding <a class="reference external" href="glossary.html#directive">directive</a> is in effect,
-Leo uses the following <a class="reference external" href="glossary.html#settings">settings</a> to translate to and from unicode:</p>
-<dl class="docutils">
-<dt>default_derived_file_encoding</dt>
-<dd>The encoding used for external files if no &#64;encoding <a class="reference external" href="glossary.html#directive">directive</a> is in effect.
-This setting also controls the encoding of files that Leo writes.
-The default is UTF-8 (case not important).</dd>
-<dt>new_leo_file_encoding</dt>
-<dd><p class="first">The encoding specified in the following line of new .leo files:</p>
-<div class="highlight-python"><pre>&lt;?xml version="1.0" encoding="UTF-8"&gt;</pre>
-</div>
-<p class="last">The default is UTF-8 (upper case for compatibility for old versions of Leo).</p>
-</dd>
-</dl>
-</div>
-<div class="section" id="i-get-weird-results-when-defining-unicode-strings-in-scripts-what-is-going-on">
-<h3><a class="toc-backref" href="#id68">I get weird results when defining unicode strings in scripts.  What is going on?</a><a class="headerlink" href="#i-get-weird-results-when-defining-unicode-strings-in-scripts-what-is-going-on" title="Permalink to this headline">¶</a></h3>
-<p>Add the following to the start of your scripts:</p>
-<div class="highlight-python"><pre>@first # -*- coding: utf-8 -*-</pre>
-</div>
-<p>Without this line, constructs such as:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">u</span> <span class="o">=</span> <span class="s">u&#39;a-(2 unicode characters here)-z&#39;</span>
-<span class="n">u</span> <span class="o">=</span> <span class="s">&#39;a-(2 unicode characters here)-z&#39;</span>
-</pre></div>
-</div>
-<p>will not work when executed with Leo&#8217;s execute script command.
-Indeed, the Execute Script command creates the script by writing the tree
-containing the script to a string. This is done using Leo&#8217;s write logic, and
-this logic converts the unicode input to a utf-8 encoded string. So <em>all
-non-ascii characters</em> get converted to their equivalent in the utf-8 encoding.
-Call these encoding &lt;e1&gt; and &lt;e2&gt;. In effect the script becomes:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">u</span> <span class="o">=</span> <span class="s">u&#39;a-&lt;e1&gt;-&lt;e2&gt;-z&#39;</span>
-<span class="n">u</span> <span class="o">=</span> <span class="s">&#39;a-&lt;e2&gt;-&lt;e&gt;-z&#39;</span>
-</pre></div>
-</div>
-<p>which is certainly <em>not</em> what the script writer intended!
-Rather than defining strings using actual characters, Instead, one should use
-the equivalent escape sequences. For example:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">u</span> <span class="o">=</span> <span class="s">u&#39;a-</span><span class="se">\\</span><span class="s">u0233-</span><span class="se">\\</span><span class="s">u8ce2-z&#39;</span>
-<span class="n">u</span> <span class="o">=</span> <span class="s">&#39;a-</span><span class="se">\\</span><span class="s">u0233-</span><span class="se">\\</span><span class="s">u8ce2-z&#39;</span>
-</pre></div>
-</div>
-</div>
-<div class="section" id="some-characters-are-garbled-when-importing-files-what-can-i-do">
-<h3><a class="toc-backref" href="#id69">Some characters are garbled when importing files. What can I do?</a><a class="headerlink" href="#some-characters-are-garbled-when-importing-files-what-can-i-do" title="Permalink to this headline">¶</a></h3>
-<p>The encoding used in the file being imported doesn&#8217;t match the encoding in effect for Leo.
-You have two options:</p>
-<ul class="simple">
-<li>Use the &#64;encoding <a class="reference external" href="glossary.html#directive">directive</a> in an ancestor of the <a class="reference external" href="glossary.html#node">node</a> selected when
-doing the Import <a class="reference external" href="commands.html">command</a> to specify the encoding of file to be imported.</li>
-</ul>
-</div>
-<div class="section" id="python-s-print-statement-shows-byte-hash-for-unicode-characters-what-can-i-do">
-<h3><a class="toc-backref" href="#id70">Python&#8217;s print statement shows &#8216;byte hash&#8217; for unicode characters.  What can I do?</a><a class="headerlink" href="#python-s-print-statement-shows-byte-hash-for-unicode-characters-what-can-i-do" title="Permalink to this headline">¶</a></h3>
-<p>First, you must change Python&#8217;s default encoding to something other than &#8216;ascii&#8217;.  To do this, put the following in your sitecustomize.py file in Python&#8217;s Lib folder:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span>
-<span class="n">sys</span><span class="o">.</span><span class="n">setdefaultencoding</span><span class="p">(</span><span class="s">&#39;utf-8&#39;</span><span class="p">)</span> <span class="c"># &#39;iso-8859-1&#39; is another choice.</span>
-</pre></div>
-</div>
-<p>You must restart Python after doing this: sys.setdefaultencoding can not be called after Python starts up.</p>
-<p>Leo&#8217;s g.es_print and g.pr functions attempts to convert incoming arguments to unicode using the default encoding.
-For example, the following Leo script shows various ways of printing La Peña properly:</p>
-<div class="highlight-python"><pre>@first # -*- coding: utf-8 -*-
-
-import sys
-e = sys.getdefaultencoding()
-print 'encoding',e
-table = (
-    'La Peña',
-    unicode('La Peña','utf-8'),
-    u'La Peña',
-    u'La Pe\\xf1a',
-)
-
-for s in table:
-    print type(s)
-    g.es_print('g.es_print',s)
-    if type(s) != type(u'a'):
-        s = unicode(s,e)
-    print 'print     ',s
-    print 'repr(s)   ',repr(s)</pre>
-</div>
-<p>For still more details, see:
-<a class="reference external" href="http://www.diveintopython.org/xml_processing/unicode.html">http://www.diveintopython.org/xml_processing/unicode.html</a></p>
-</div>
-</div>
-</div>
-
-
-          </div>
-        </div>
-      </div>
-      <div class="sphinxsidebar">
-        <div class="sphinxsidebarwrapper">
-            <p class="logo"><a href="leo_toc.html">
-              <img class="logo" src="_static/Leo4-80-border.jpg" alt="Logo"/>
-            </a></p>
-  <h4>Previous topic</h4>
-  <p class="topless"><a href="testimonials.html"
-                        title="previous chapter">What People Are Saying About Leo</a></p>
-  <h4>Next topic</h4>
-  <p class="topless"><a href="slides.html"
-                        title="next chapter">Slides</a></p>
-<div id="searchbox" style="display: none">
-  <h3>Quick search</h3>
-    <form class="search" action="search.html" method="get">
-      <input type="text" name="q" size="18" />
-      <input type="submit" value="Go" />
-      <input type="hidden" name="check_keywords" value="yes" />
-      <input type="hidden" name="area" value="default" />
-    </form>
-    <p class="searchtip" style="font-size: 90%">
-    Enter search terms or a module, class or function name.
-    </p>
-</div>
-<script type="text/javascript">$('#searchbox').show(0);</script>
-        </div>
-      </div>
-      <div class="clearer"></div>
-    </div>
-    <div class="related">
-      <h3>Navigation</h3>
-      <ul>
-        <li class="right" style="margin-right: 10px">
-          <a href="genindex.html" title="General Index"
-             >index</a></li>
-        <li class="right" >
-          <a href="slides.html" title="Slides"
-             >next</a> |</li>
-        <li class="right" >
-          <a href="testimonials.html" title="What People Are Saying About Leo"
-             >previous</a> |</li>
-        <li><a href="leo_toc.html">Leo v4.9 documentation</a> &raquo;</li> 
-      </ul>
-    </div>
-    <div class="footer">
-        &copy; Copyright 2011, Edward K. Ream.
-      Last updated on Oct 31, 2011.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.4.
-    </div>
-  </body>
-</html>

leo-doc-zh/IPythonBridge.html

-
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    
-    <title>IPython and Leo &mdash; Leo v4.9 documentation</title>
-    <link rel="stylesheet" href="_static/default.css" type="text/css" />
-    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
-    <script type="text/javascript">
-      var DOCUMENTATION_OPTIONS = {
-        URL_ROOT:    '',
-        VERSION:     '4.9',
-        COLLAPSE_INDEX: false,
-        FILE_SUFFIX: '.html',
-        HAS_SOURCE:  true
-      };
-    </script>
-    <script type="text/javascript" src="_static/jquery.js"></script>
-    <script type="text/javascript" src="_static/underscore.js"></script>
-    <script type="text/javascript" src="_static/doctools.js"></script>
-    <script type="text/javascript" src="_static/sidebar.js"></script>
-    <link rel="top" title="Leo v4.9 documentation" href="index.html" />
-    <link rel="next" title="Embedding Leo with the leoBridge module" href="leoBridge.html" />
-    <link rel="prev" title="Leo and Emacs" href="emacs.html" /> 
-  </head>
-  <body>
-    <div class="related">
-      <h3>Navigation</h3>
-      <ul>
-        <li class="right" style="margin-right: 10px">
-          <a href="genindex.html" title="General Index"
-             accesskey="I">index</a></li>
-        <li class="right" >
-          <a href="leoBridge.html" title="Embedding Leo with the leoBridge module"
-             accesskey="N">next</a> |</li>
-        <li class="right" >
-          <a href="emacs.html" title="Leo and Emacs"
-             accesskey="P">previous</a> |</li>
-        <li><a href="leo_toc.html">Leo v4.9 documentation</a> &raquo;</li> 
-      </ul>
-    </div>  
-
-    <div class="document">
-      <div class="documentwrapper">
-        <div class="bodywrapper">
-          <div class="body">
-            
-  <div class="section" id="ipython-and-leo">
-<h1><a class="toc-backref" href="#id3">IPython and Leo</a><a class="headerlink" href="#ipython-and-leo" title="Permalink to this headline">¶</a></h1>
-<p>Leo&#8217;s ipython plugin provides two-way communication (a bridge) between Leo and
-IPython: you can run Leo scripts from IPython, and IPython scripts from Leo. To
-use this plugin, you must <a class="reference external" href="installing.html#running-leo-from-a-console-window">run Leo in a console window</a>. When this plugin is
-enabled, Leo&#8217;s start-ipython command starts <a class="reference external" href="http://ipython.scipy.org/">IPython</a> in this console.</p>
-<p>Remarkably, Leo and IPython run simultaneously in the same process,
-yet their separate event loops do not interfere with each other.
-Scripts run from IPython <em>immediately</em> change Leo,
-<em>exactly</em> as if the script were run from Leo.
-Conversely, scripts run from Leo <em>immediately</em> affect the IPython interpreter.
-As a result, Leo might be considered an <a class="reference external" href="http://projects.scipy.org/ipython/ipython/wiki/NoteBook">IPython Notebook</a>.</p>
-<p>The bridge between Leo and IPython is powerful because it is simple. Indeed,</p>
-<p>1. <strong>You can run any IPython script from Leo</strong>.
-On the Leo side, a single statement:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">ip</span> <span class="o">=</span> <span class="n">IPython</span><span class="o">.</span><span class="n">ipapi</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>
-</pre></div>
-</div>
-<p>assigns ip to IPython&#8217;s _ip variable. The ip variable allows scripts running in
-Leo to do <em>anything</em> that an IPython script can do.</p>
-<p>2. <strong>You can run any Leo script from IPython</strong>.
-The ipython plugin injects a single object named &#8216;_leo&#8217; into the IPython namespace.
-IPython scripts access Leo&#8217;s c and g objects as
-follows:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">c</span><span class="p">,</span><span class="n">g</span> <span class="o">=</span> <span class="n">_leo</span><span class="o">.</span><span class="n">c</span><span class="p">,</span> <span class="n">_leo</span><span class="o">.</span><span class="n">g</span>
-</pre></div>
-</div>
-<p>The c and g variables allow scripts running in IPython to do <em>anything</em> that a
-Leo script can do.</p>
-<p>This is basically everything that is required for IPython-Leo interaction.
-However, you probably wont use &#8216;c&#8217; and &#8216;g&#8217; directly, but use a series of
-convenience wrappers described in this document that make interactive work
-painless and powerful.</p>
-<div class="contents topic" id="contents">
-<p class="topic-title first">Contents</p>
-<ul class="simple">
-<li><a class="reference internal" href="#ipython-and-leo" id="id3">IPython and Leo</a><ul>
-<li><a class="reference internal" href="#introduction" id="id4">Introduction</a></li>
-<li><a class="reference internal" href="#installation-and-startup" id="id5">Installation and startup</a></li>
-<li><a class="reference internal" href="#accessing-ipython-from-leo" id="id6">Accessing IPython from Leo</a></li>
-<li><a class="reference internal" href="#accessing-leo-nodes-from-ipython" id="id7">Accessing Leo nodes from IPython</a></li>
-<li><a class="reference internal" href="#cl-definitions" id="id8">&#64;cl definitions</a></li>
-<li><a class="reference internal" href="#special-node-types" id="id9">Special node types</a></li>
-<li><a class="reference internal" href="#launching-ileo-from-ipython" id="id10">Launching ILeo from IPython</a></li>
-<li><a class="reference internal" href="#declaring-custom-push-to-ipython-handlers" id="id11">Declaring custom push-to-ipython handlers</a></li>
-<li><a class="reference internal" href="#example-code-snippets" id="id12">Example code snippets</a></li>
-<li><a class="reference internal" href="#example-use-case-pylab" id="id13">Example use case: pylab</a></li>
-<li><a class="reference internal" href="#magic-functions" id="id14">Magic functions</a></li>
-<li><a class="reference internal" href="#acknowledgements-and-history" id="id15">Acknowledgements and history</a></li>
-</ul>
-</li>
-</ul>
-</div>
-<div class="section" id="introduction">
-<h2><a class="toc-backref" href="#id4">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
-<p>ILeo, or leo-ipython bridge, creates a two-way communication channel between Leo
-and IPython. The level of integration is much deeper than conventional
-integration in IDEs; most notably, you are able to store and manipulate <strong>data</strong>
-in Leo nodes, in addition to mere program code - essentially making ILeo a
-hierarchical spreadsheet, albeit with non-grid view of the data. The
-possibilities of this are endless, and the approach can be applied in wide range
-of problem domains with very little actual coding.</p>
-<p>IPython users are accustomed to using things like %edit to produce non-trivial
-functions/classes (i.e. something that they don&#8217;t want to enter directly on the
-interactive prompt, but creating a proper script/module involves too much
-overhead). In ILeo, this task consists just going to the Leo window, creating a node
-and writing the code there, and pressing alt+I (push-to-ipython).</p>
-<p>Obviously, you can save the Leo document as usual - this is a great advantage
-of ILeo over using %edit, you can save your experimental scripts all at one
-time, without having to organize them into script/module files (before you
-really want to, of course!)</p>
-</div>
-<div class="section" id="installation-and-startup">
-<h2><a class="toc-backref" href="#id5">Installation and startup</a><a class="headerlink" href="#installation-and-startup" title="Permalink to this headline">¶</a></h2>
-<p>You need at least Leo 4.4.8, and IPython 0.8.3</p>
-<p>The ILeo concept is still being developed actively, so if you want to get access
-to latest features you can get IPython from Launchpad by installing bzr and
-doing:</p>
-<div class="highlight-python"><pre>bzr branch lp:ipython
-cd ipython
-python setupegg.py develop</pre>
-</div>
-<p>You need to enable the &#8216;ipython.py&#8217; plugin in Leo:</p>
-<ul class="simple">
-<li>Help -&gt; Open LeoSettings.leo</li>
-<li>Edit &#64;settings&#8211;&gt;Plugins&#8211;&gt;&#64;enabled-plugins, add/uncomment &#8216;ipython.py&#8217;</li>
-<li>Alternatively, you can add &#64;settings&#8211;&gt;&#64;enabled-plugins with body ipython.py to your leo document.</li>
-<li>Restart Leo. Be sure that you have the console window open
-(<a class="reference external" href="installing.html#running-leo-from-a-console-window">run Leo in a console window</a>, or double-click leo.py on windows)</li>
-<li>When using the Qt ui, add &#8211;ipython argument to command line (e.g. launchLeo.py &#8211;ipython).</li>
-<li>Press alt+shift+i OR alt-x start-ipython to launch IPython in the console that
-started leo. You can start entering IPython commands normally, and Leo will keep
-running at the same time.</li>
-<li>Note that you can just press alt-I (push-to-ipython) - it will start IPython
-if it has not been previously started. However, when you open a new leo
-document, you have to execute start-ipython (alt+shift+I) again to tell
-IPython that the new commands should target the new document. IPython session
-will not be restarted, only the leo commander object is updated in the
-existing session.</li>
-<li>If you want to specify command line arguments to IPython (e.g. to choose a
-profile, or to start in &#8216;pylab&#8217; mode), add this to your &#64;settings:
-<a class="reference external" href="mailto:'&#37;&#52;&#48;string">'<span>&#64;</span>string</a> ipython_argv = ipython -pylab&#8217; (where -pylab is the command line argument)</li>
-</ul>
-</div>
-<div class="section" id="accessing-ipython-from-leo">
-<h2><a class="toc-backref" href="#id6">Accessing IPython from Leo</a><a class="headerlink" href="#accessing-ipython-from-leo" title="Permalink to this headline">¶</a></h2>
-<div class="section" id="ipython-code">
-<h3>IPython code<a class="headerlink" href="#ipython-code" title="Permalink to this headline">¶</a></h3>
-<p>Just enter IPython commands on a Leo node and press alt-I to execute
-push-to-ipython in order to execute the script in IPython. &#8216;commands&#8217; is
-interpreted loosely here - you can enter function and class definitions, in
-addition to the things you would usually enter at IPython prompt - calculations,
-system commands etc.</p>
-<p>Everything that would be legal to enter on IPython prompt is legal to execute
-from ILeo.</p>
-<p>Results will be shows in Leo log window for convenience, in addition to the console.</p>
-<p>Suppose that a node had the following contents:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="mi">1</span><span class="o">+</span><span class="mi">2</span>
-<span class="k">print</span> <span class="s">&quot;hello&quot;</span>
-<span class="mi">3</span><span class="o">+</span><span class="mi">4</span>
-
-<span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">x</span><span class="p">):</span>
-    <span class="k">return</span> <span class="n">x</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span>
-
-<span class="n">f</span><span class="p">(</span><span class="s">&#39;hello world&#39;</span><span class="p">)</span>
-</pre></div>
-</div>
-<p>If you press alt+I on that node, you will see the following in Leo log window (IPython tab):</p>
-<div class="highlight-python"><pre>In: 1+2
-&lt;2&gt; 3
-In: 3+4
-&lt;4&gt; 7
-In: f('hello world')
-&lt;6&gt; 'HELLO WORLD'</pre>
-</div>
-<p>(numbers like &lt;6&gt; mean IPython output history indices; the actual object can be
-referenced with _6 as usual in IPython).</p>
-</div>
-<div class="section" id="plain-python-code">
-<h3>Plain Python code<a class="headerlink" href="#plain-python-code" title="Permalink to this headline">¶</a></h3>
-<p>If the headline of the node ends with capital P, alt-I will not run the code
-through IPython translation mechanism but use the direct python &#8216;exec&#8217; statement
-(in IPython user namespace) to execute the code. It wont be shown in IPython
-history, and sometimes it is safer (and more efficient) to execute things as
-plain Python statements. Large class definitions are good candidates for P
-nodes.</p>
-</div>
-</div>
-<div class="section" id="accessing-leo-nodes-from-ipython">
-<h2><a class="toc-backref" href="#id7">Accessing Leo nodes from IPython</a><a class="headerlink" href="#accessing-leo-nodes-from-ipython" title="Permalink to this headline">¶</a></h2>
-<p>The real fun starts when you start entering text to leo nodes, and are using
-that as data (input/output) for your IPython work.</p>
-<p>Accessing Leo nodes happens through the variable <strong>wb</strong> (short for &#8220;WorkBook&#8221;)
-that exist in the IPython user namespace. Nodes that are directly accessible are
-the ones that have simple names which could also be Python variable names;
-&#8216;foo_1&#8217; will be accessible directly from IPython, whereas &#8216;my scripts&#8217; will not.
-If you want to access a node with arbitrary headline, add a child node &#8216;&#64;a foo&#8217;
-(&#64;a stands for &#8216;anchor&#8217;). Then, the parent of &#8216;&#64;a foo&#8217; is accessible through
-&#8216;wb.foo&#8217;.</p>
-<p>You can see what nodes are accessible be entering (in IPython) wb.&lt;TAB&gt;. Example:</p>
-<div class="highlight-python"><pre>[C:leo/core]|12&gt; wb.
-wb.b           wb.tempfile    wb.rfile       wb.NewHeadline
-wb.bar         wb.Docs        wb.strlist     wb.csvr
-[C:leo/core]|12&gt; wb.tempfile
-            &lt;12&gt; &lt;ipy_leo.LeoNode object at 0x044B6D90&gt;</pre>
-</div>
-<p>So here, we meet the &#8216;LeoNode&#8217; class that is your key to manipulating Leo
-content from IPython!</p>
-<div class="section" id="leonode">
-<h3>LeoNode<a class="headerlink" href="#leonode" title="Permalink to this headline">¶</a></h3>
-<p>Suppose that we had a node with headline &#8216;spam&#8217; and body:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="p">[</span><span class="s">&#39;12&#39;</span><span class="p">,</span><span class="mi">2222</span><span class="o">+</span><span class="mi">32</span><span class="p">]</span>
-</pre></div>
-</div>
-<p>we can access it from IPython (or from scripts entered into other Leo nodes!) by doing:</p>
-<div class="highlight-python"><pre>C:leo/core]|19&gt; wb.spam.v
-           &lt;19&gt; ['12', 2254]</pre>
-</div>
-<p>&#8216;v&#8217; attribute stands for &#8216;value&#8217;, which means the node contents will be run
-through &#8216;eval&#8217; and everything you would be able to enter into IPython prompt
-will be converted to objects. This mechanism can be extended far beyond direct
-evaluation (see <a class="reference external" href="mailto:'&#37;&#52;&#48;cl">'<span>&#64;</span>cl</a> definitions&#8217;).</p>
-<p>&#8216;v&#8217; attribute also has a setter, i.e. you can do:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">wb</span><span class="o">.</span><span class="n">spam</span><span class="o">.</span><span class="n">v</span> <span class="o">=</span> <span class="s">&quot;mystring&quot;</span>
-</pre></div>
-</div>
-<p>Which will result in the node &#8216;spam&#8217; having the following text:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="s">&#39;mystring&#39;</span>
-</pre></div>
-</div>
-<p>What assignment to &#8216;v&#8217; does can be configured through generic functions
-(&#8216;simplegeneric&#8217; module, see ipy_leo.py for examples).</p>
-<p>Besides v, you can set the body text directly through:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">wb</span><span class="o">.</span><span class="n">spam</span><span class="o">.</span><span class="n">b</span> <span class="o">=</span> <span class="s">&quot;some</span><span class="se">\n</span><span class="s">string&quot;</span><span class="p">,</span>
-</pre></div>
-</div>
-<p>headline by:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">wb</span><span class="o">.</span><span class="n">spam</span><span class="o">.</span><span class="n">h</span> <span class="o">=</span> <span class="s">&#39;new_headline&#39;</span>
-</pre></div>
-</div>
-<p>(obviously you must access the node through wb.new_headline from that point
-onwards), and access the contents as string list (IPython SList) through
-&#8216;wb.spam.l&#8217;.</p>
-<p>If you do &#8216;wb.foo.v = 12&#8217; when node named &#8216;foo&#8217; does not exist, the node titled
-&#8216;foo&#8217; will be automatically created and assigned body 12.</p>
-<p>LeoNode also supports go() that focuses the node in the Leo window, and ipush()
-that simulates pressing alt+I on the node (beware of the possible recursion!).</p>
-<p>You can access unknownAttributes by .uA property dictionary. Unknown attributes
-allow you to store arbitrary (pickleable) python objects in the Leo nodes; the
-attributes are stored when you save the .leo document, and recreated when you
-open the document again. The attributes are not visible anywhere, but can be
-used for domain-specific metadata. Example:</p>
-<div class="highlight-python"><pre>[C:leo/core]|12&gt; wb.spam.uA['coords'] = (12,222)
-[C:leo/core]|13&gt; wb.spam.uA
-            &lt;13&gt; {'coords': (12, 222)}</pre>
-</div>
-</div>
-<div class="section" id="accessing-children-with-iteration-and-dict-notation">
-<h3>Accessing children with iteration and dict notation<a class="headerlink" href="#accessing-children-with-iteration-and-dict-notation" title="Permalink to this headline">¶</a></h3>
-<p>Sometimes, you may want to treat a node as a &#8216;database&#8217;, where the nodes
-children represent elements in the database. You can create a new child node for
-node &#8216;spam&#8217;, with headline &#8216;foo bar&#8217; like this:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">wb</span><span class="o">.</span><span class="n">spam</span><span class="p">[</span><span class="s">&#39;foo bar&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Hello&quot;</span>
-</pre></div>
-</div>
-<p>And assign a new value for it by doing:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="n">wb</span><span class="o">.</span><span class="n">spam</span><span class="p">[</span><span class="s">&#39;foo bar&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">v</span> <span class="o">=</span> <span class="s">&quot;Hello again&quot;</span>
-</pre></div>
-</div>
-<p>Note how you can&#8217;t use .v when you first create the node - i.e. the node needs
-to be initialized by simple assignment, that will be interpreted as assignment
-to &#8216;.v&#8217;. This is a conscious design choice.</p>
-<p>If you try to do wb.spam[&#8216;bar&#8217;] = &#8216;Hello&#8217;, ILeo will assign &#8216;&#64;k bar&#8217; as the
-headline for the child instead, because &#8216;bar&#8217; is a legal python name (and as
-such would be incorporated in the workbook namespace). This is done to avoid
-crowding the workbook namespace with extraneous items. The item will still be
-accessible as wb.spam[&#8216;bar&#8217;]</p>
-<p>LeoNodes are iterable, so to see the headlines of all the children of &#8216;spam&#8217; do:</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">wb</span><span class="o">.</span><span class="n">spam</span><span class="p">:</span>
-    <span class="k">print</span> <span class="n">n</span><span class="o">.</span><span class="n">h</span>
-</pre></div>
-</div>
-</div>
-</div>
-<div class="section" id="cl-definitions">
-<h2><a class="toc-backref" href="#id8">&#64;cl definitions</a><a class="headerlink" href="#cl-definitions" title="Permalink to this headline">¶</a></h2>
-<p>If the first line in the body text is of the form <a class="reference external" href="mailto:'&#37;&#52;&#48;cl">'<span>&#64;</span>cl</a> sometext&#8217;, IPython will
-evaluate &#8216;sometext&#8217; and call the result with the rest of the body when you do
-&#8216;wb.foo.v&#8217; or press alt+I on the node. An example is in place here. Suppose that we have defined a class (I
-use the term class in a non-python sense here):</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">rfile</span><span class="p">(</span><span class="n">body</span><span class="p">,</span><span class="n">node</span><span class="p">):</span>
-    <span class="sd">&quot;&quot;&quot; @cl rfile</span>
-
-<span class="sd">    produces a StringIO (file like obj) of the rest of the body &quot;&quot;&quot;</span>
-
-    <span class="kn">import</span> <span class="nn">StringIO</span>
-    <span class="k">return</span> <span class="n">StringIO</span><span class="o">.</span><span class="n">StringIO</span><span class="p">(</span><span class="n">body</span><span class="p">)</span>
-</pre></div>
-</div>
-<p>(note that node is ignored here - but it could be used to access headline,
-children etc.),</p>
-<p>Now, let&#8217;s say you have node &#8216;spam&#8217; with text:</p>
-<div class="highlight-python"><pre>@cl rfile
-hello
-world
-and whatever</pre>
-</div>
-<p>Now, in IPython, we can do this:</p>
-<div class="highlight-python"><pre>[C:leo/core]|22&gt; f = wb.spam.v
-[C:leo/core]|23&gt; f
-            &lt;23&gt; &lt;StringIO.StringIO instance at 0x04E7E490&gt;
-[C:leo/core]|24&gt; f.readline()
-            &lt;24&gt; u'hello\n'
-[C:leo/core]|25&gt; f.readline()
-            &lt;25&gt; u'world\n'
-[C:leo/core]|26&gt; f.readline()
-            &lt;26&gt; u'and whatever'
-[C:leo/core]|27&gt; f.readline()
-            &lt;27&gt; u''</pre>
-</div>
-<p>You should declare new &#64;cl types to make ILeo as convenient your problem domain
-as possible. For example, a &#8220;&#64;cl etree&#8221; could return the elementtree object for
-xml content.</p>
-<p>In the preceding examples, the return value matter. That, of course, is optional.