Using the Leo editor

texelart, 123rf.com

texelart, 123rf.com

Noting, Planning, Programming

Programmers and web designers need to manage a variety of information from one central point. The Leo editor steps up to the challenge in several clever ways.

Although its makers describe it as an "IDE, PIM and outliner," the Leo editor [1] does more than just provide a standalone development environment. Moreover, the software can work with other IDEs, such as Emacs and Vim.

The Leo editor program provides a simple interface that presents all information about a project in four areas (Figure 1). In the upper left, the outline view shows all the documents belonging to a project. To the right is the log with all the actions that occurred in Leo. The various tabs call up more functions for the log, such as a search or notifications of specific tasks. Below it are the content indicators for the files. Depending on the type of file, the lower part divides again into the overview of the file contents.

Figure 1: The Leo window with its four areas provides a good overview of a project, its contents, and changes in the log.

Installation

Because the Leo editor is a Python program, it doesn't necessarily need installation. That said, the directions on the homepage are not very helpful and, as the Ubuntu PPA isn't quite up to date, you may have to follow these instructions carefully to get everything working.

Once you download the sources from GitHub, you can use the leo-install.py script in the directory to set up Leo. But, you can also do without it. You only need to give your system the path to the Leo directory and you should be able to execute it from anywhere:

$ PATH=${PATH}:${HOME}/leo-4-11
$ export PATH

Next, start the software with python launchleo.py . The prerequisite is a Python installation along with the PyQt package, which most installations already have. If any of these two dependencies are missing, install them in the usual way using the package manager. The complete settings management is in Leo format (Figure 2). The configuration file is itself a Leo project, which is a good indicator of its basic work mode. After all, Leo's direct access to the Python data allows it to be modified and enhanced at will, which also applies to the settings.

Figure 2: The editor settings themselves are implemented as a Leo outline. This makes almost all parameters adaptable and they can be automated through Python scripts.

Work Mode

The editor first collects texts and saves them as text files in a .leo file. To ensure that Leo knows during saving and exporting how to handle files, it marks them with directives. Apart from this particularity, Leo is not distinguishable from other programming environments and works similarly to any other IDE-cum-text editor. However, you may become more a part of the action with Leo when using Python, because you can customize the application to your needs while at the same time working on other projects.

If you want to use your favorite editor together with Python, maybe because its file management suits you, nothing stands in your way. You can integrate Leo into Emacs with a Pymacs script and then work in Emacs with the Leo data and commands. With Vim, it's just the opposite, because Leo by default has a series of built-in Vim commands.

You can integrate other programs with Python background with the Leo editor through the leoBridge module or the IPython bridge.

Directives

To work with external data Leo has, among other things, the directives @file and @all . If you create a new node in the outline editor with a prefixed @file (Figure 3), the editor creates an external file or calls it up if it already exists. Such a file can contain a wide variety of information, such as plain text, but also code snippets and subprograms, even in different programming languages. This brings me to the @all command. When Leo encounters it, the software exports all files in a new file, while maintaining the predetermined Leo outline order.

Figure 3: The @file directive (outlined in red) instructs Leo to create or import external data. The data can be external function definitions or a CSS file, as in the case of this HTML document.

Other directives address the syntax highlighting. Highlighting can be configured in various ways, where Leo takes into account the different programming languages used in the project. Further directives control the behavior of the editor. While importing external data, it can add comments to the files. If this something you don't want, you can create a so-called shadow tree with the @shadow directive that ensures that the original external files remain untouched.

Using Leo

Some features might appear unusual at first, so the comprehensive tutorial [2] the developers put together is a must. There are some videos that delve into the environment and even lead programmers step by step through implementing their own projects.

As an example, the project maintainer uses Leo data or outlines for programming Leo itself or developing it further, focusing on the particularities of the program, such as directives and the working methodology of the programming environment.

Is Leo Just an IDE?

The Leo editor is first and foremost an outliner, read program, with which you can save and edit information in a structured form. Programs or source code are just one of the many structured information instances can manage.

Leo's way of storing data makes it a flexible tool with which you can also store and edit other text data. For example, you can quickly create your own Personal Information Manager from the IDE with just a few tweaks. With other programs, this would be just an address book or contact list, but Leo turns it into a collection of topical information. Ultimately, a contact differs from a programming project only in content, not structure. Leo collects in program outlines the same external data, such as libraries, code fragments, comments and, when appropriate, documentation and instructions.

Because the editor exports the information in PDF and HTML format, depending on the needs of the user, it also serves as a web development or documentation tool. This becomes meaningful in that Leo, through its directives, can export different files as one document, which it can then format according to the user's wishes. An output file of this type can consist of, for example, web page headers, content, and footers that are compiled from various referenced files.

Conclusion

The Leo editor might not win any beauty contests any time soon, but it proves to be a very useful piece of software that knows few bounds. Its Python framework doesn't restrict it as far as the operating system or in its use as an IDE, outliner, or general information collector.

Infos

  1. Leo editor: http://leoeditor.com
  2. Documentation: http://leoeditor.com/leo_toc.html