Emacs Versor: Versatile Cursors

GNUemacs has many ways of navigating text buffers: words, expressions, sentences, functions, paragraphs... but they can be much harder to type than the ordinary cursor movements. Versor (Versatile Cursors) makes them more accessible, mapping pairs of these movement dimensions onto the cursor keys, and using the cursor keys themselves, with a modifier, to navigate around the space of possible movement types. It also provides an extended cursor, in the form of a whole unit (or units) of whatever your selected movement dimension is, and makes this the unit of copying, deletion or other changes, as well as of movement.

A few more types of movement, not previously available, are also implemented, such as a ``nested blocks'' facility (for HTML tags etc) with movements equivalent to forward-sexp, down-list, backward-up-list, etc (and where these are provided by a mode, as for example psgml-mode does, Versor gives access to them just as it does to brackets); and movements over tabular markup data for HTML, CSV, TeX and LaTeX.

Languide (Language-Guided editing)

In addition to the forms of navigation provided above, Versor includes a high-level editing package, Languide (Language-Guided editing) that provides such operations as:

Converting a code block into a function and putting a call to it in place of the original code block (automatically working out what parameters are needed), leaving a framework for the function call on the top of the kill ring ready for re-use.

Converting an expression into a local variable, and finding a likely suitable scoping point, and leaving the variable at the top of the kill ring ready for re-use.

The implementation of these facilities is structured as language-independent core logic and sets of definitions for different languages, currently supporting Lisp, C, and some of Java. (Support is planned for other languages, including shell, Perl, Python, and Haskell.)

Languide also provides Versor with language-guided movements on top of any provided by the languages' major modes; these are typically structured as statement and statement-parts (head, body, tail).

Aims

Versor aims to reduce the number of keystrokes needed to acheive many common kinds of edit, and to reduce the mistakes and the frustration of correcting them. Now that we have high-level languages, it seems a pity to be editing them almost entirely character-by-character; Versor (and Languide) try to use the structure of the language to help the editor user, but without the restrictions of the restrictive ``structure editors'' that never proved popular.

Other inputs, and accessibility

Versor is useable through narrow-channel interfaces such as footswitches (six switches to give convenient access to the whole package), and also through voice, thus allowing Emacs to be operated completely or partly without use of the hands.

The design also allows it to be used, albeit cumbersomely, through as few as two input switches.

It may also be used through just the keypad, apart from the relatively rare occasions when a new word really must be entered; since programs in most languages are composed of a fixed set of keywords and punctuation characters, and function and variable names that have to be defined to be used, much editing can be done without ever having to type any visible characters.

Non-interference with normal editing

Versor integrates smoothly with underlying Emacs, and its extended cursor quietly disappears whenever you use non-Versor commands.

Seeing it in action

You can step your way through a series of screenshots, starting from here. This lets you see it in action without having to download and install.

Introduction to Versor An explanation of the ideas behind versor Versor with speech output Versor includes an interface to Emacspeak.

Getting started

To run the demo, you need to unpack the tarball, and put the versor code directory on your load-path , with the directory demo beside it, load the file versor-demo.el , and run the command versor-demo . This will do an animated, non-interactive, demo of the main features of versor.

Alternatively, you can view the demo on the web, as a series of screenshots, here.

For more details of installation, see the installation section of the manual.

In short, you need to add something along the lines of the following to your .emacs:

(add-to-list 'load-path "/path/to/versor/lisp") (require 'versor) (require 'languide) (versor-setup)

You can control many options by giving arguments to versor-setup . The author recommends the following:

(versor-setup 'arrows 'arrows-misc ;; this makes versor use the arrow keys, rather ;; than the keypad cluster 'modal ;; this keeps separate dimensions for each mode 'text-in-code ;; this keeps a different movement system for ;; within comments / string literals, from ;; that for within actual code 'menu) ;; make a menu available

The manuals

You can read the two parts of the manual, for versor and for languide, which are also available, as info files, within the download.

Status

The package has recently been announced on various lists and sites. Code contributions are welcomed, as is feedback of all kinds.

Another emacs package

Another project that may be of interest to those who work intensively in Emacs is Sidebrain, a programmers' memory aide for keeping track of the detail of programming tasks.

This research has been supported by the Science Foundation Ireland Investigator Programme, B4-STEP (Building a Bi-Directional Bridge Between Software ThEory and Practice).

Versor and Languide were created by John C G Sturdy, and are hosted on Sourceforge.