Contents
Leo no longer supports the Tk gui. The Qt gui now does everything the Tk gui did and better.
Removed show/hide/toggle minibuffer commands. The minibuffer is an essential part of Leo.
These settings are no longer used:
@string selected-background-color
@string selected-command-background-color
The import-at-root command is no longer supported.
Support multiple @language directives in a single node As with @color directives, only unambiguous @language directives affect the default coloring of descendant nodes.
Colorize url’s in the body text. You can open url’s by control-clicking on them, or by using the open-url command.
Use @file extension by default if there is no @language directive in effect. This is oh so useful.
Unified extract commands. This command creates a child node from the selected body text as follows:
- If the selection starts with a section reference, the section name become the child’s headline. All following lines become the child’s body text. The section reference line remains in the original body text.
- If the selection looks like a Python class or definition line, the class/function/method name becomes child’s headline and all selected lines become the child’s body text.
- Otherwise, the first line becomes the child’s headline, and all selected lines become the child’s body text.
Note that the extract-section-names command remains. The extract-section and extract-python-method commands are gone.
The import-file commands replaces all the following commands:
import-at-file
import-cweb-files
import-derived-file
import-flattened-outline
import-noweb-files
Leo chooses one of the above commands as follows. First, if the file looks like an external file that Leo wrote, the command works like import-derived-file command. Otherwise, the file’s extension determines the importer:
.cw, .cweb: import-cweb-files
.nw, .noweb: import-noweb-files
.txt: import-flattened-outline
all others: import-at-file
The import-at-root command is no longer supported.
Terminology: the legacy (aka tabbed) autocompleter shows completions in Leo’s tabbed pane. The new (aka qcompleter) autocompleter shows completions in or near the body pane.
There is little change to the legacy completer, except that no text is highlighted in the body pane during completion. This is calmer than before. Furthermore, there is no longer any need for highlighting, because when the user types a backspace the legacy completer now simply deletes a single character instead of the highlighted text.
One minor change: the legacy completer now does insert characters that do not match the start of any possible completion. This is an experimental feature, but it might play well with using codewise completions as a fallback to leo-related completions.
Both the legacy and new completer now work exactly the same way, because they both use the AutoCompleterClass to compute the list of completions.
The strict “stateless” requirement means that the “intermediate” completions must be entered into the body pane while completion is active. It works well as a visual cue when using the tabbed completer: indeed, the tabbed completer would be difficult to use without this cue.
The situation is slightly different with the qcompleter. Adding code before the user accepts the completion might be considered an “advanced” feature. However, it does have two important advantages, especially when “chaining” across periods: it indicates the status of the chaining and it limits what must appear in the qcompleter window.
The codewise-oriented completions appear to work well. In large part, this is due to adding the global “self.” completions to all class-related completions (kind == ‘class’ in ac.get_codewise_completions). This looks like a really good hack, and it eliminates the need for the ContextSniffer class.
Performance of leo-related completions is much better than before. The old code used Python’s inspect module and was horribly complex. The new code uses eval and is perfectly straightforward.
The present codewise-related code caches completions for all previously-seen prefixes. This dramatically speeds up backspacing. Global caching is possible because completions depend only one the present prefix, not on the presently selected node. If ContextSniffer were used, completions would depend on the selected node and caching would likely be impractical. Despite these improvements, the performance of codewise-oriented completions is noticeably slower than leo-related completions.
The ac.get_cached_options cuts back the prefix until it finds a cached prefix. ac.compute_completion_list then uses this (perhaps-way-too-long-list) as a starting point, and computes the final completion list by calling g.itemsMatchingPrefixInList.
This may not be absolutely the fastest way, but it is much simpler and more robust than attempting to do “prefix AI” based on comparing old and new prefixes. Furthermore, this scheme is completely independent of the how completions are actually computed. The autocompleter now caches options lists, regardless of whether using eval or codewise.
In most cases the scheme is extremely fast: calls to get_completions replace calls to g.itemsMatchingPrefixInList. However, for short prefixes, the list that g.g.itemsMatchingPrefixInList scans can have thousands of items. Scanning large lists can’t be helped in any case for short prefixes.
Happily, the new scheme is still completely stateless: the completionDict does not define state (it is valid everywhere) and no state variables had to be added. In short, the new caching scheme is much better than before, and it probably is close to optimal in most situations.
The viewrendered plugin creates a window for live rendering of images, movies, sounds, rst, html, etc.
viewrendered.py creates the following (Alt-X) commands:
Opens a new rendering window.
By default, the rendering pane renders body text as reStructuredText, with all Leo directives removed. However, if the body text starts with < (after removing directives), the body text is rendered as html.
Important: The default rendering just described does not apply to nodes whose headlines begin with @image, @html, @movie, @networkx, @svg and @url. See the section called Special Renderings below.
Rendering sets the process current directory (os.chdir()) to the path to the node being rendered, to allow relative paths to work in .. image:: directives.
For example, both:
Heading
-------
`This` is **really** a line of text.
and:
<h1>Heading<h1>
<tt>This</tt> is <b>really</b> a line of text.
will look something like:
Heading
This is really a line of text.
Important: reStructuredText errors and warnings will appear in red in the rendering pane.
This plugin renders @image, @html, @movie, @networkx, @svg and @url nodes in special ways.
For @image, @movie and @svg nodes, either the headline or the first line of body text may contain a filename. If relative, the filename is resolved relative to Leo’s load directory.
@graphics-script executes the script in the body text in a context containing two predefined variables:
- gs is the QGraphicsScene for the rendering pane.
- gv is the QGraphicsView for the rendering pane.
Using these variables, the script in the body text may create graphics to the rendering pane.
@image renders the file as an image.
@html renders the body text as html.
@movie plays the file as a movie. @movie also works for music files.
@networkx is non-functional at present. It is intended to render the body text as a networkx graph. See http://networkx.lanl.gov/
@svg renders the file as a (possibly animated!) svg (Scalable Vector Image). See http://en.wikipedia.org/wiki/Scalable_Vector_Graphics Note: if the first character of the body text is < after removing Leo directives, the contents of body pane is taken to be an svg image.
@url is non-functional at present.
Terry Brown created this initial version of this plugin, and the free_layout and NestedSplitter plugins used by viewrendered.
If you type a plain up/down arrow key while editing a headline, Leo will act as if you had typed the corresponding alt- arrow key. That is, Leo will end editing of the headline and go to the next previous node. Leo will end editing even if there is no next/ previous node, which is convenient.
A single click on an already-selected tree node edits the headline
Enabled only if @bool single_click_auto_edits_headline = True.
Added a splash screen
The –no-splash command-line option suppresses the splash screen. In addition, Leo puts up no splash screen when the –silent or –script command-line options are given. To change the splash screen, replace leoIconsSplashScreen.jpg with another image.
The apropos commands now print in a separate area if possible. The commands use the scrolledmessage plugin if possible, which in turn uses the viewrendered plugin by default. This makes the apropos messages much more visible.
Handle click events like alt-x or ctrl-g Clicking in the minibuffer now is equivalent to alt-x, provided that the minibuffer is not in use. Clicking most places outside the minibuffer is equivalent to ctrl-g. Catching clicks is much safer than catching focus events.
The first loaded file sets tabbed gui size
Enter insert mode after ctrl-h. This is a vim-related improvement.
Disabled find/change text areas in find panel. This reduces confusion.
Added the replace-current-character command. It replaces the character to the left of the cursor, or replaces the selection range if there is one.
Added toggle-case-region command.
Added save-all command. It saves all changed windows.
Added insert-hard/soft-tab commands.
Added commands to manage uA’s:
clear-all-uas
clear-node-uas
print-all-uas
print-node-uas
set-ua
Renamed the ‘abbrev-mode’ to ‘toggle-abbrev-mode’.
Added namespace arg in c.executeScript
Put Kent Tenney’s Runwith class in scripts.leo and contrib.
Kent writes, “I’ve had endless problems with interpreter versioning, leading me create the Runwith class. It writes a file to disk, makes it executable, runs it, captures exitcode, err and output, removes the files, provides reports. This provides complete decoupling from Leo.”
Call os.chdir when executing scripts.
Fixed ancient, major bug: F3 now makes sure to save headline changes
Fixed old bug: set-find-x commands no longer abort find commands
The commands that switch find scope, set-find-xxx, no longer terminate the find command, if one is active. This is an old bug, and it’s good to fix it.
Fixed recent bugs in the viewrendered and scrolledmessage plugins
An earlier rev fixed a bug that effectively destroyed the viewrendered plugin. It was caused by the new convention that alleviates the need for many @language directives. The fix was simply to enable the update_rst method if the massaged p.b is not empty.
ScrolledMessageDialog.convertMessage now renders rst by default, unless either the html or text button is pressed. There really should be three radio buttons: text, html or rST, but that’s a tiny interface glitch. The actual bug however, was much more serious: rst was never being rendered.
Fixed chapters problems
http://groups.google.com/group/leo-editor/browse_thread/thread/3f15a855ca38b26e
The new code is more relaxed about where @chapter nodes may reside. They are always created as the last child of the first @chapters node in the outline (the @chapters, plural, node is created as needed). However, you may move them while in the “main” chapter, with no ill effects. In fact, you could swap @chapter nodes with the same name: when you select a chapter, Leo will use (show) the first node it finds.
The new code is now both more careful and more tolerant of @chapter nodes deleted by hand. The chapter will still appear in the dropdown list: if you select it you will give a polite warning. That’s all. In particular, the deleted chapter will remain in the dropdown list until you use the proper chapter-remove command. That’s about the only sane alternative: it allows you to resurrect the chapter, by hand or with an undo.
This is all made possible because the new code is almost completely stateless. The only exception is the saved position used to select a node when selecting a chapter. The old position-based findPositionInChapter method has been simplified to make it work more reliably. It first looks for a “perfect” match using positions, and then degrades to looking for a vnode match. In practice, most matches are, in fact, perfect. The “imperfect” case typically happens when the user alters nodes in @chapter trees by hand in the “main” chapters.
Technical highlights:
The check for c.positionExists(p) in c.setCurrentPosition continues to fail when deleting @chapter nodes. However, the code now simply falls back to c.rootPosition, without any apparent harm.
The chapterController and chapter classes are now completely stateless, except for chapter.p.
- chapter.findPositionInChapter has been simplified and generalized. It now falls back to a reasonable value, based on p.v, if chapter.p does not exist.
- All chapterController code now recomputes the location of @chapters and @chapter nodes whenever those locations are needed.
- All chapter commands are unchanged in their actual workings, but all contain a care “preamble” of checking code.
Added unit test for all chapter commands. All interactive commands now have an xByName helper for use by unit tests.
Added lockout to leoQtTreeTab. This prevents flash during the rename chapter command.
Rewrote chapter.chapterSelectHelper. This reduces, but does not eliminate, the number of warnings given by c.setCurrentPosition.
Fixed recent bug: handle ‘Escape’ character properly
The fix was a last-minute adjustment in leoQtEventFilter.create_key_event.
Fixed caps-lock problem
The fix was yet another last-minute fix leoQtEventFiler.create_key_event.
Made sure all keys contribute to lossage
Simplified Leo’s key handling, an important improvement to Leo’s core.
Changed names of commands so they have common prefixes
Any custom key bindings (none are bound by default) will have to change.
The new prefixes are:
abbrev- abbreviation commands buffer- buffer command directory- director commands file- file commands gc- garbage collection macro- macro expansion rectangle- rectangle commands register register commandsThe already existing prefixes are:
apropos- help ddabrev- dynamic abbreviations find- find commands isearch- incremental search print- print information run- run unit tests toggle- toggle settings yank- yank
Finished macros
The macro-load and macro-save are as simple as possible.
No further work will be done on macros unless somebody really wants these commands.
Added support for word-only option for regular expressions
When the word-only option is in effect, Leo ensures that the search pattern begins and ends with the ‘b’ anchor.
Leo’s startup code now forces the qt gui: it changes qttabs to qt.
Added support for expanded sections in plugin. Added three new options:
expand_noweb_references
True: Replace references by definitions. Definitions must be descendants of the referencing node.
ignore_noweb_definitions
True: ignore section definition nodes.
expand_noweb_recursively
True: recursively expand definitions by expanding any references found in definitions.
Leo now writes @file files with the simplest possible sentinel lines.
- Eliminated @-node sentinels.
- Eliminated @nl and @nonl sentinels.
- Simpler representation of @doc and @ in sentinels.
- Simplified representation of @others and section references.
- Use a scheme much like Emacs org-mode to represent headline level.
The result is, provably, the simplest possible representation of Leo’s outline structure in external files.
The Qt Gui now supports drag and drop in Leo outlines.
You can drag files into Leo. Leo will create @file or @auto nodes if appropriate.
The execute-script now calls execfile (or its equivalent when using Python 3k) when @bool write_script_file = True. This allows pdb (or pudb) to show the text of Leo scripts!
Added p.deletePositionsInList, an important new helper.
Added g.findTestScript, an important new pattern for sharing code in Leo scripts, including scripts in @test nodes.
Suppose there is common code that I want to include in several unit tests:
class Hello(): def __init__(self,name='john'): self.name=name print('hello %s' % name)I put this in a node called ‘Common test code’. Now the unit tests can “import” the code as follows:
exec(g.findTestScript('Common test code'))After this exec statement completes the class Hello is available to the test code! This is something that I’ve wanted to do forever.
If the body text is non-empty, it is assumed to contain the URL. This is a remarkably important improvement–it allows the headline to contain a description of the url.
When abbreviation mode is on (abbrev-mode toggles this mode) Leo will expand abbreviations as you type. Type the name of an abbreviation, followed by a space. As soon as you type the space, Leo will replace the name by the abbreviations value. You can undo the replacement as usual.
Note that defining any abbreviation automatically turns on abbreviation mode.
The add-global-abbreviation command (<alt-x>add-gl<tab><return>) takes the selected text as the replacement value of the abbreviation. The minibuffer prompts you for the name of the abbreviation.
Three new settings apply to the abbreviation commands:
@bool enable-abbreviations (default: False)
When true, enables substitution of abbreviations.
@data global-abbreviations
@data abbreviations
In both cases, body text contains lines of the form:
name=valuename is the abbreviation name, value is the substituted text. Whitespace is ignore around the name, but is significant in the value. Abbreviation names may contain only alphabetic characters, but may start with the ‘@’ sign.
By convention @data global-abbreviations setting should be defined in myLeoSettings.leo, while @data abbreviations should be defined in other .leo files. Regardless of where they are defined, abbreviations in @data abbreviation nodes will override settings (with the same name) in @data global-abbreviations nodes.
Leo can now open multiple files from the command line.
Specify fonts in @font nodes:
@font plain null font
plain_null_font_family = Times New Roman
plain_null_font_size = 16
plain_null_font_slant = roman
plain_null_font_weight = bold
That is, the actual font specs are in the body text. Everything except @font is ignored in the headline.
Specify font colors with @color nodes:
@color plain null color = black
Added support for minibuffer colors. Added the following options with the indicated defaults:
@color minibuffer_background_color = lightblue
@color minibuffer_warning_color = lightgrey
Added support for @string qt-toolbar-location = <spot>
Valid values for <spot> are top,bottom,left,right
Added support for @bool write_expansion_bits_in_leo_files.
The -screen-shot command-line argument tells Leo to take a screenshot and exit.
The --window-size command-line argument specifies the initial size of the Leo window. This is especially useful with the screen-shot command-line argument:
--window-size=600x900 # <height> x <width>, in pixels.
Added support for @bool at_auto_separate_non_def_nodes option.
When true, the @auto file importers put inter-def code in their own node. The default (legacy mode) is False.
Several important improvements to Leo’s installer for Windows.
Leo doesn’t create @chapter nodes for new files.
Leo now uses PyEnchant to check spelling.
This is much safer than the old Aspell wrapper.
All @auto nodes end with a newline.
Leo now writes @edit nodes like @nosent nodes.
Added legend for print-settings command.
Improved the importer for elisp.
Added an .ini importer.
Created introductory slide shows.
Reorganized the users guide.
Improved the installation instructions.
Added support for .nsi files.
Leo 4.7 accomplishes something I long thought to be impossible: the unification of vnodes and tnodes. tnodes now longer exist: vnodes contain all data. The Aha that made this possible is that iterators and positions allow a single node to appear in more than one place in a tree traversal.
Leo requires Python 2.6 or above, including Python 3.0 and above.
Leo now treats @file nodes just like it treats @thin nodes. This makes Leo much safer to use in cooperative environments that use source code control systems. As part of this change, Leo no longer supports @noref nodes.
@auto-rst now works much more reliably.
Leo now has a simple, robust, and extremely useful scheme to recover from clone conflicts, no matter how they may arise. This removes all the dread from “node changed” messages. It is easy to see what the changes were, and it is easy to choose what, if anything to do.
When a clone conflict occurs, you will see a red message in the log pane and a “Recovered Nodes” node as the last top-level node. This node has one child per red message. Each of these children contains two nodes: an “old” node and a “new” node. Unless there are multiple conflicts for a single node, the “new” node will have “won”: every clone contains the new node’s headline and body text. All these nodes are plain nodes, not clones. It is up to you to change the corresponding clone nodes if you choose to do so.
Leo minimizes unnecessary changes to .leo files. Leo writes outline-size and orientation to the cache in your .leo directory. This eliminates unnecessary changes to .leo files.
Leo now creates temporary files in the systems standard temporary directory. This prevents Leo from over-writing user-generated .bak files.
The qt colorizer now supports font specifications in @font nodes.
Added options for vim plugin. The setting:
@string vim_trigger_event = icondclick2
is the default. It opens vim when the user double-clicks the icon box. Alternatives are:
@string vim_trigger_event = iconclick2
@string vim_trigger_event = select2
The former opens vim on single clicks in the icon bar. The latter opens vim whenever a new node is selected in Leo.
Leo opens a default .leo file if no other is specified, using the @string default_leo_file setting. The default for this setting is:
~/.leo/workbook.leo
Added escapes for underindented lines. The escape is specified by the @string underindent-escape-string setting. By default, this escape is - If a line starts with -N, Leo will write the line with N fewer spaces than expected.
Leo now warns when attempting to write a file that has been changed outside of Leo. This prevents bzr reversions.
Leo tests syntax of .py files when saving them.
Leo can now open any file into an @edit node. This allows Leo to be associated with the edit action of .py files. Like this:
C:\Python26\python.exe "c:\leo.repo\trunk\launchLeo.py" --gui=qt %1 %2
Leo now warns if when writing an @auto node if the the file exists and the node has not been read previously. This prevents a newly-created @auto node from overwriting an existing file.
Added support for @auto-rst nodes. These import reStructuredText (rST) files so that the files can be “round-tripped” without introducing extraneous changes. This makes Leo a superb environment for using rST.
Added g.posList.
c.config.doEnabledPlugins sets g.app.config.enabledPluginsFileName
Added script to leoSettings.leo to ensure all menu items are valid.
c.config.getSettingSource(setting_name) returns the name of the file which Leo used to determine the setting:
- D indicates default settings.
- F indicates the file being loaded
- L indicates leoSettings.leo
- M indicates myLeoSettings.leo
Predefined ‘self’ in @test/@suite nodes.
@string default_leo_file = ~/.leo/workbook.leo
@string underindent-escape-string = -
@int icon_bar_widgets_per_row
Added support for meta keys.
The qt gui is now the default.
The old bindings bound the PageUp/Down keys to back/forward page commands, and these commands work only for text.
The new default bindings in leoSettings.leo: @keys EKR bindings are:
back-page ! text = PageUp
back-page-extend-selection ! text = Shift-PageUp
forward-page ! text = PageDn
forward-page-extend-selection ! text = Shift-PageDn
scroll-down-half-page ! tree = Shift-PageDn
scroll-down-page ! tree = PageDn
scroll-up-half-page ! tree = Shift-PageUp
scroll-up-page ! tree = PageUp
@bool enable_alt_ctrl_bindings. The default is False, needed for AltGr functionality on Windows.
Added g.Tracer class. This is a Python ‘debugger’ that computes a call graph. To trace a function and its callers, put the following at the function’s start:
g.startTracer()
The find-character command now finds characters across line boundaries.
Set cwd in read/write commands. This affect the following commands: open, save, save-as, save-to, read-outline-only, read-file-into-node, write-file-from-node and all the import/export commands.
Leo creates the .leo folder in the user’s HOME directory, and puts several configuration files there. Leo looks for myLeoSettings.leo in HOME/.leo. Leo uses os.path.expanduser(“~”) if there is no home setting.
The default settings for @shadow files are now located in leoSettings.leo in the node:
@settings-->File options-->Shadow files
The defaults for these settings are::
@string shadow_prefix = x
@string shadow_subdir = .leo_shadow
Added support for @bool fixedWindow option.
Leo suppresses marks, expansion state, orphan bits and current position bits when writing fixed .leo files. As a result, all nodes will be collapsed and the root node will always be selected when Leo opens a fixed .leo file.
You can optionally specify the size and position on the screen of fixed .leo files by putting an '@data fixedWindowPosition’ node in the @settings tree of myLeoSettings.leo or leoSettings.leo. You should not put such a node in the fixed .leo file itself–everyone who opens the file would get that fixed position.
The body of the '@data fixedWindowPosition’ node should contain something like this:
# Must be four entries: width,height,left,top. # Put this in myLeoSettings.leo, **not** in individual .leo files. 1200 800 50 50
Added @bool cleo_color_ignore = True
This determines whether cleo colors @ignore headlines. The default is True.
find-next-clone
toggle-sparse-move
Replaced the delete-all-icons command with a script in scripts.leo. This command was too dangerous.
delete-all-icons
delete-first-icon
delete-last-icon
delete-node-icons
insert-icon
reverse-sort-lines
reverse-sort-lines-ignoring-case.
sort-lines-ignoring-case
toggle-collapse_nodes_during_finds
@bool at_auto_warns_about_leading_whitespace
This option has effect only when importing so-called non-strict languages, for which leading whitespace is not terribly significant.
@bool warn_when_plugins_fail_to_load
There is also an @bool trace_plugins setting.
@bool vim_plugin_opens_url_nodes
vim.py does not open url nodes if this setting is False.
Leo 4.4.4 contains many important features originally planned for later releases. The highlights of Leo 4.4.4:
The Great Graph Aha: A Leo outline doesn’t have to be an arbitrary graph in order to represent an arbitrary graph.
That is, simple scripts allow Leo outlines to represent arbitrary directed graphs. There is no need for a separate ‘graph world’. The graphed.py plugin is a direct result of this Aha. It allows you to create general graphs from Leo outlines.
Support for @auto nodes. Such nodes allow people to collaborate using Leo without inserting Leo sentinels in the files Leo generates.
@menus trees in settings files create all of Leo’s menus. It is now dead easy to make Leo’s menus look the way you want.
@buttons trees in settings files create common @button nodes created in all Leo outlines.
A new, faster, colorizer plugin replaces the __jEdit_colorizer__ plugin.
New commands for resolving cvs conflicts.
Leo’s core is now compatible with jython.
The Great Graph Aha is:
A Leo outline doesn’t have to be an arbitrary graph in order to represent an arbitrary graph.
So the graph world is unnecessary because we can use Leo nodes and trees as data to other graphing packages.** That is, Python scripts can build arbitrary graphs using Leo’s existing nodes and trees. And Python scripts can manipulate those graphs. And Python scripts could do the reverse: manipulate the Leo outline by traversing general graphs. So there is no need to complicate Leo’s fundamental data structures. Hurray! Instead, we build on the strengths of already existing graphing packages.
The Great Graph Aha created the opportunity for immediate action:
test.leo contains the essential scripts to implement graphs in Leo files. These short, simple, self-contained, easily modifiable scripts make possible everything ever envisaged by the (now-defunct) graph world project:
leo2graph: convert a normal Leo tree to a NetworkX graph.
at-graph2graph: convert an @graph tree to a NetworkX graph.
at-networkx2graph: convert an @networkx tree to a NetworkX graph
at-networkx2at-graph: create an @graph tree from an @networkx tree.
2. The graphed plugin allows users to manipulate parts of Leo outlines as if they were general graphs. It is still early days for this exciting plugin.
@auto trees allows people to use Leo in collaborative environments without using sentinels in the files Leo generates. In contrast to @nosent, @auto trees can change when the corresponding file changes outside of Leo.
Leo will automatically recreate (import) all @auto trees when reading a .leo file, and will write all dirty @auto trees when saving a .leo file. There are two exceptions to this statement:
1. Leo will never read (import) or write an @auto tree if the root @auto tree is under the influence of an @ignore directive.
2. Saving a .leo file does not save @auto nodes if a) they haven’t been changed or b) they do not contain a significant amount of information. An @auto tree contains a significant amount of information if it has children or if the root node contains more than 10 characters.
Leo creates @auto trees by parsing the corresponding external file. Parsers create descendant nodes of the @auto tree: one node for each class, method and function in the external file.
Parsers presently exist for C, elisp, Java, Pascal, PHP and Python. Leo determines the language using the file’s extension. If no parser exists for a language, the entire body of an @auto tree contains a significant amount of information if it has any children or if the root node contains more than 10 non-blank lines. the external file is copied to the body of the @auto node.
Leo does not write the contents of @auto trees to .leo files. In this respect, @auto trees work much like @file trees. @auto trees whose root node is under the scope of an @ignore directive will be written to the .leo, just like @file trees.
Leo performs several checks to ensure that the result of importing an external file will be equivalent to the file that writing the @auto tree would produce.
These checks can produces errors or warnings. Errors indicate a potentially serious problem. Leo inserts an @ignore directive in the @auto tree if any error is found. This @ignore directive prevents the @auto tree from modifying the external file. If you @ignore directive, a later write of the @auto tree will attempt to fix the problems that gave rise to the errors. There are no guarantees however.
Strict languages are languages like Python for which leading whitespace is especially significant. Before importing a file for a strict language, Leo regularizes the leading whitespace of all lines of the original source file. That is, Leo converts blanks to tabs or tabs to blanks depending on the value of the @tabwidth directive in effect for the @auto node. Leo cannot guarantee to reproduce the original source file exactly if problems are discovered while regularizing leading whitespace.
After importing a file, Leo verifies that writing the @auto node would create the same file as the original file. For strict languages, the comparison must be exact, or nearly so. For non-strict languages, differences in leading whitespace generate warnings, not errors.
File comparison mismatches can arise for several reasons:
Leo will issue a warning (not an error) for underindented Python comment lines. Such lines can not change the meaning of Python programs.
All present parsers are short overrides of a powerful base parser class. Thus, it would be simple to add support for other languages. See the node:
@file leoImport.py-->Import-->Scanners for createOutline
in leoPy.leo to see how easy it is to create new parsers.
The so-called resolve-cvs-conflict project has resolved itself into small, easily understood commands.
The read-file-into-node command prompts for a filename, and creates an node whose headline is @read-file-into-node <filename> and whose body text is the entire contents of the file.
The write-file-from-node command writes the body text of the selected not to a file. If the headline of the presently selected node starts with @read-file-into-node the command use the filename that follows in the headline. Otherwise, the command prompts for a filename.
When a cvs conflict occurs, the user will:
Any file can be fixed in this way, including external files and .leo files. The only complication is that the user must not change sentinel lines. Two new commands check the contents of a node: The check-derived-file and check-leo-file commands tell whether a trial read of the presently selected node can be done successfully. The check-derived-file command assumes the body text is a external file; the check-leo-file command assumes the body text is an entire .leo file.
The compare-leo-outlines command prompts for another (presumably similar) .leo file that will be compared with the presently selected outline file (main window). It then creates clones of all inserted, deleted and changed nodes.
All @buttons tree in a settings file defines global buttons that are created in the icon area of all .leo files. You define @button nodes in the @buttons tree as usual.
Essentially all of Leo’s startup code now runs with jython 2.2 and the (unfinished!) swing gui.
The prototype in test.leo now will use PIL (Python Imaging Library) if available, so many more kinds of icons can be used. Buttons now exist to add icons to do the following:
Fixed a bug in the icon handling in the outline widget that caused duplicate icons not to be drawn properly.
See the release notes for a list of bugs fixed in Leo 4.4.4.
Added the ‘clear-all-marks’ hook.
Added button font setting. See the node:
"@settings-->Fonts-->@font button font" in leoSettings.leo.
Plugins and scripts may call the c.frame.canvas.createCanvas method to create a log tab containing a Tk.Canvas widget. Here is an example script:
log = c.frame.log ; tag = 'my-canvas'
w = log.canvasDict.get(tag)
if not w:
w = log.createCanvas(tag)
w.configure(bg='yellow')
log.selectTab(tag)
Improved the yank and yank-pop commands and added @bool add_ws_to_kill_ring setting.
Improved the debug command: it now adds the following code to the beginning of debug scripts:
class G:
def es(s,c=None):
pass
g = G()
Added the @bool rst3 strip_at_file_prefixes setting.
Added the g.app.inBridge ivar.
Added @bool big_outline_pane setting. False (legacy): Top pane contains outline and log panes. True: Top pane contains only the outline pane. Bottom pane contains body and log panes.
check-derived-file
check-leo-file
compare-leo-outlines
insert-child
read-at-auto-nodes
read-file-into-node
write-at-auto-nodes
write-dirty-at-auto-nodes
write-file-from-node
The highlights of Leo 4.4.3:
Leo’s vnode and tnode classes are now completely independent of the rest of Leo. Some api’s have been changed. This ‘big reorg’ and may affect scripts and plugins.
extend-to-line
extend-to-paragraph
extend-to-sentence
forward-end-word
forward-end-word-extend-selection
Further improved outline navigation:
Improved the mod_scripting plugin:
Changed default settings:
focus-to-body = Alt-D
focus-to-tree = Alt-T
toggle-extend-mode = Alt-3
Leo’s vnode and tnode classes can optionally be compatible with ZODB databases, i.e., they can optionally derive from ZODB.Persistence.Persistent. See Chapter 17: Using ZODB with Leo for details.
The main features of Leo 4.4.1 are:
cycle-focus
debug
find-character
find-word
hide-invisibles
isearch-with-present-options
open-users-guide
python-help
run-unit-test
toggle-autocompleter
toggle-calltips
toggle-invisibles
@bool autoindent_in_nocolor_mode
@bool flash_matching_brackets
@bool idle_redraw
@bool trace_bind_key_exceptions
@bool warn_about_redefined_shortcuts
@color flash_brackets_background_color
@color flash_brackets_foreground_color
@int flash-brackets-delay
@int flash_brackets_count
@string close_flash_brackets
@string open_flash_brackets
@string editor_orientation
The main features of Leo 4.4 are:
activate-cmds-menu
activate-edit-menu
activate-file-menu
activate-help-menu
activate-outline-menu
activate-plugins-menu
activate-window-menu
add-space-to-lines
add-tab-to-lines
clean-lines
clear-selected-text
click-click-box
click-headline
click-icon-box
clone-find-all
contract-and-go-right
contract-body-pane
contract-log-pane
contract-outline-pane
contract-pane
double-click-headline
double-click-icon-box
dump-all-objects
dump-new-objects
expand-body-pane
expand-log-pane
expand-outline-pane
expand-pane
find-again
find-all
find-tab-change
find-tab-change-all
find-tab-change-then-find
find-tab-find command
find-tab-find-previous
free-text-widgets
fully-expand-body-pane
fully-expand-log-pane
fully-expand-outline-pane
fully-expand-pane
goto-first-sibling
goto-global-line
goto-last-sibling
help
help-for-command
hide-body-pane
hide-find-tab
hide-log-pane
hide-minibuffer
hide-outline-pane
hide-pane,
open-find-tab
open-find-tab
open-outline-by-name (uses filename completion)
open-spell-tab
print-bindings
print-commands re-search-backward
re-search-forward
remove-space-from-lines
remove-tab-from-lines
replace-string
scroll-down
scroll-down-extend-selection
scroll-outline-down-line
scroll-outline-down-page
scroll-outline-up-line
scroll-outline-up-page
scroll-up
scroll-up-extend-selection
search-backward
search-forward
search-with-present-options
set-find-everywhere
set-find-node-only
set-find-suboutline-only
show-colors
show-fonts
show-minibuffer
show-search-options
simulate-begin-drag
simulate-end-drag
toggle-find-ignore-case-option
toggle-find-in-body-option,
toggle-find-in-headline-option
toggle-find-mark-changes-option
toggle-find-mark-finds-option
toggle-find-regex-option
toggle-find-reverse-option
toggle-find-word-option and
toggle-find-wrap-around-option
toggle-mini-buffer
verbose-dump-objects
word-search-backward
word-search-forward
Changed path to stylesheet in the rst3 plugin.
Fixed crasher in Word (and other) plugins.
Fixed problem with labels plugin.
Added the following commands for the groupoperations plugin:
group-operations-clear-marked
group-operations-mark-for-copy
group-operations-mark-for-move
group-operations-mark-for-clone
group-operations-mark-target
group-operations-operate-on-marked
group-operations-transfer
Installed cleo patch.
The scripting plugin now supports shortcuts in @button nodes:
@button name @key=shortcut
The scripting plugin now supports @command nodes:
@command name @key=shortcut
Added new settings:
@bool allow_idle_time_hook
@bool autocomplete-brackets.
@bool gc_before_redraw
@bool minibufferSearchesShowFindTab
@bool show_only_find_tab_options
@bool show_tree_stats
@bool trace_autocompleter
@bool trace_bindings
@bool trace_doCommand
@bool trace_f.set_focus
@bool trace_focus
@bool trace_g.app.gui.set_focus
@bool trace_gc
@bool trace_gc_calls
@bool trace_gc_verbose
@bool trace_key_event
@bool trace_masterClickHandler
@bool trace_masterCommand
@bool trace_masterFocusHandler
@bool trace_masterKeyHandler
@bool trace_minibuffer
@bool trace_modes
@bool trace_redraw_now
@bool trace_select
@bool trace_status_line
@bool trace_tree
@bool trace_tree_alloc
@bool trace_tree_edit
@bool useCmdMenu
@bool useMinibuffer
@bool use_syntax_coloring
@color body_text_selection_background_color
@color body_text_selection_foreground_color.
@color log_pane_Find_tab_background_color
@color log_pane_Spell_tab_background_color, etc.
@int max_undo_stack_size,
@string trace_bindings_filter
@string trace_bindings_pane_filter
Added @shortcuts nodes.
Leo now supports per-pane bindings of the form:
command-name ! pane = shortcut
The spelling settings replace the settings in spellpyx.ini.