Zap Documentation      Latest release     
ZapRedraw      Contact      Download     

Previous | Contents | Index | Next

Chapter 9: Advanced use

Here we look at a final set of advanced functions, before moving on to modes. These features are all 'convenience' features, rather than being important things that you can't do without.

9.1 Setting and using marks

Often it is useful to be able to remember where you are in a file at a specific time, so that you can return to it later. Zap allows you to do this by using marks, which are controlled from the Misc->Marking menu or from keystrokes.

To toggle a mark - set if there isn't one there, clear if there is - use TOGGLEMARK, on sF11. To set a mark, use DROPMARK (F6). To move to the next mark, use NEXTMARK (sF9), and to move to the previous mark, use LASTMARK (sF6). For instance, if you set a mark, then move and set another one, sF6 will move you back to the second mark, sF6 again to the first, and then sF9 back to the second mark again.

Marks can't be seen when they are set; they can be set to any depth.

9.2 Working with read only files

Zap has two types of read only files: firstly there are permanent read only files. These tend to be internal documentation files. You can't set these to be writable.

Secondly, there are temporary read only files; you can set these up yourself by the File->Read only menu option - the same option turns off the read only aspect again. This means that you can temporarily write-protect a file to stop yourself from doing anything stupid to it. Zap also loads any file that it won't be able to save changes to as temporary read only.

If you try to edit a read only file, Zap beeps at you and prints a warning in the minibuffer.

9.3 Zap's help system

Zap can provide help on the current mode you are using, as well as any keystroke, command or function. Pressing c\ brings up a small menu in the minibuffer. You can press:

To get help on a keystroke in anything other than the base keymap, first change into that keymap, and then run the HELP command (either through the minibuffer, or through whatever it's bound to in that keymap).

Zap can also display help on its menus and dialogues in Acorn's Help; it also displays help for the relevant mode if the cursor is over an editing window.

Note that the ZapText extension also gives Zap the ability to look up help on whatever is at the cursor using StrongHelp. To do this, press cH (you'll need both ZapText and StrongHelp installed to do this - StrongHelp is available from

9.4 Zap's command language

Pressing cEscape brings up the minibuffer and allows you to enter commands directly into Zap. This is very useful, because Zap has lots of commands (and you can get extensions to provide additional ones), and there simply aren't enough keystrokes or menu items to go round.

If you don't know how to use a command, you can type c\ c (help on commands) and then type in the command name for a brief description.

9.4.1 Command syntax

Commands can take a parameter; there are four different types. If you request help on a command, the parameter type will be shown as:

Byte and word parameters must be preceded by an & if in hex, and may be surrounded by brackets or quotes; string parameters must be either in double quotes " or in brackets ( and ). Within a double-quoted string, double quotes themselves can be included by doubling them up (eg: INSERT "Suddenly, Jonathon said ""Hey""."). For byte and word parameters, 'x' is evaluated to the ASCII value of the character x (eg: CHAR 'n' inserts the letter n).

An error is given if the parameter you place after the command does not match the type of the command, except that if you omit a string parameter, the minibuffer will be opened for you to type the string into. (This is exactly what happens when you press cEscape, in fact - cEscape executes the command COMMAND without any parameters, allowing you to specify your own command.)

Commands can be chained together by using colon as a separator : as in BASIC. You cannot chain together commands which use the minibuffer (ie: commands which take a string as a parameter but with the string unspecified).

You can put a comment after a command by using ; (eg: COMMAND ; comment). The comment terminates at the first : (so you can put comments between commands when you chain multiple commands together).

This section has provided only a basic introduction to using simple commands. See chapter 11 for a complete description of Zap's command language, including functions, variables, and conditional and looping constructs.

9.5 Learning and playing back actions

This feature of Zap is very simple to use, and very useful. To start 'learning' a key sequence, simply press cL. Type the sequence you wish to learn and then press cL again. Press F1 to execute the learnt sequence. (EXECUTE, bound to F1, also stops the learning process.)

Note firstly that Zap will beep after every keypress you make to remind you that it is being stored. Secondly note that the Escape key will not stop the learning process. Only cL will stop it. Thus you can learn sequences which use incremental search, or keyboard selection of regions; both these actions involve the Escape key.

Once you have learnt a sequence, you may 'bind' that sequence to a key so that pressing that key in future causes the same series of actions to take place. To do this press cF8 and then press the key you want to bind the sequence to (or Escape if it was a mistake - Escape won't be bound).


9.6 The universal argument: repeating actions

The universal argument feature enables you to execute a keypress an arbitrary number of times. Suppose for example you wanted to insert 100 spaces. The quick way to do this is to type cU 100 Space.

In general you type cU then the number of times you want the key to be executed, then press Return, then press the key to execute. The 'pressing Return' step can be omitted if the key you want to repeat is not delete or a digit or another valid key for editing the number you are typing (as in the example above).

Some commands (and therefore the keystrokes they are bound to) can't be sensibly executed more than once (for instance OPENPARENT, which opens the directory containing the current file); in these cases the universal argument simply won't affect the command or keystroke.

9.7 Object Linking and Embedding, and External Edit

Zap supports both OLE and EE for editing files. These are used by a large number of other programs that wish to have data edited for them, but don't know how to do it themselves. External Edit is primarily used for editing text, and Zap will edit all Text files (&FFF) for EE. Object Linking and Embedding allows non-textual files to be edited as well; Zap will claim both BASIC (&FFB) and Text (&FFF) files for OLE.

Note that these file types, as well as those that Zap claims for running from the Filer, can be configured - you need to edit ZapUser:Config.!ZapBoot and ZapUser:Config.!ZapRun.

The next section in the manual is chapter 10, which explains Zap's different editing and displaying modes, and looks at some of the most useful ones. Modes form the key to many of Zap's most useful features, and since they've been occasionally mentioned in the manual up till now you probably want to learn more about them.

Alternatively, you could move on to chapter 11, which explains in more detail Zap's command language, including a look a functions, variables, and conditional and looping constructs.

Previous | Contents | Index | Next

© Copyright Zap Developers 1992-2004. All Rights Reserved.