All Manuals > Editor User Guide > 2 General Concepts

2.5 Executing commands

2.5.1 Modifier keys — Command, Ctrl, Alt and Meta

Editor commands are initiated by one or more key sequences. A single key sequence usually involves holding down one of two specially defined modifier keys, while at the same time pressing another key which is usually a character key.

macOS users will be familiar with the use of the Command key in key sequences such as Command+C. These keys always work in the standard macOS way in the LispWorks editor. The remainder of this section describes the use of other modifier key.

The two modifier keys referred to are the Control (Ctrl) key and the Meta key .

When using Emacs emulation on a keyboard without a Meta key, the Escape (Esc) key can be used instead. Note that Esc must be typed before pressing the required character key, and not held down.

When using macOS editor emulation, Esc is the cancel gesture and you may not have an Emacs Meta key. Therefore LispWorks provides an alternate gesture to access editor commands: Ctrl+M. For example, to invoke the command Find Source for Dspec, type:

Ctrl+M X Find Source for Dspec

and press Return.

To continue the search, type Ctrl+M ,.

You can make either the Alt or the Command key act as the Emacs Meta key. This setting is independent of whether you are using Emacs or macOS editor emulation. See the LispWorks IDE User Guide for instructions on changing editor emulation.

An example of a single key sequence command is Ctrl+A which moves the current point to the start of the line. This command is issued by holding down the Control key while at the same time pressing A.

Some key sequences may require more than one key sequence. For example, the key sequence to save the current buffer to a file is Ctrl+X Ctrl+S. Another multi-key sequence is Ctrl+X S which saves all buffers to their relevant files. Note that in this case you do not press the Control key while pressing S.

A few commands require both the Ctrl and Meta key to be held down while pressing the character key. Meta+Ctrl+L, used to select the previous buffer displayed, is one such command. If the Esc key is being used in place of the Meta key, then this key should be pressed before the Ctrl+L part of the key sequence.

2.5.2 Two ways to execute commands

The key sequences used to execute commands, as described in the previous section, are only one way to execute an editor command. As a general rule, editor commands that are used frequently should involve as few key strokes as possible to allow for fast editing. The key sequences described above are quick and easy shortcuts for invoking commands.

Most editor commands can also be invoked explicitly by using their full names. For example, in the previous section we met the keystroke Ctrl+A which moves the current point to the beginning of the line. This keystroke is called a key binding and is a shortcut for executing the command Beginning of Line. To execute this command by name you must type Meta+X followed by the full command name (Meta+X itself is only a key binding for the command Extended Command).

Even though there may seem like a lot of typing to issue the extended version of a command, it is not generally necessary to type in the whole of a command to be executed. The Tab key can be used to complete a partially typed in extended command. The editor extends the command name as far as possible when Tab is used, and if the user is not sure of the rest of the command name, then pressing Tab again provides a list of possible completions. The command can then be selected from this list.

The most commonly used editor commands have a default binding associated with them.

2.5.3 Prefix arguments

An editor command can be supplied with an integer argument p which may alter the effect of that command. In most cases it means that the command is repeated p times. This argument is known as a prefix argument as it is supplied before the command to which it is to be applied. Prefix arguments have no effect on some commands.

See 3.4 Using prefix arguments for information about using prefix arguments.


Editor User Guide (Macintosh version) - 01 Dec 2021 19:35:08