Lugaru's Epsilon Programmer's Editor
Context:
|
Epsilon User's Manual and Reference > Commands by Topic > Simple Customizing > Command FilesEpsilon provides several commands to create and execute command files. These files contain macro definitions and key bindings in a human-readable format, as described below. The load-file command asks you for the name of a file, then executes the commands contained in it. The load-buffer command asks you for the name of a buffer, then executes the commands contained in that buffer.
Epsilon's command files appear in a human-readable format, so you can
easily modify them. Parentheses surround each command. Inside the
parentheses appear a command name, and one or two strings,
sections of text enclosed in double quotes (
You can include comments in a command file by putting a semicolon or hash sign ("#") anywhere an opening parenthesis may appear. Such a comment extends to the end of the line. Note that you cannot put a comment inside a string. Command files may contain three types of commands. The first, bind-to-key, functions like the regular Epsilon command of the same name. For bind-to-key, the first string specifies the name of some Epsilon command, and the second string represents the key whose binding you wish to modify, in a format we'll describe in detail in a moment. For instance, the following command binds the command show-matching-delimiter to }:
In a command file, define-macro allows you to define a keyboard macro. Its first string specifies the name of the new Epsilon command to define, and its second string specifies the sequence of keys you want the command to type. The define-macro command does not correspond to any single regular Epsilon command, but functions like a combination of start-kbd-macro, end-kbd-macro, and name-kbd-macro. The third command file command, create-prefix-command, takes a single string, which specifies a key, and makes that key a prefix character. It works just as the regular command of the same name does. The strings that describe keys in each of these commands use a representation similar to what Epsilon uses when it refers to some key. Normal characters represent themselves, control characters have a "C-" before them, alt characters have an "A-", and function keys have an "F-" followed by the number of the function key. Cursor keys appear in a notation like <Home>. See Keys and their Representation for details. In practice, you don't need to remember exactly how to refer to a particular key, because Epsilon provides commands that construct command files for you. See the insert-macro and insert-binding commands, described below.
You can also use the special syntax
Do not put extra spaces in command file strings that represent keys.
For example, the string
If a backslash character "\" appears in a string, it removes any
special meaning from the character that follows. For instance, to
make a string with a quote character (
If you need a string with the character " Consider this example command file:
The file defines a second macro named split-and-find. It invokes three commands by name. Notice that the macro could have invoked two of the commands by key. Invoking by name makes the macro easier to read and modify later. The redisplay command shows the action of split-window before the find-file command prompts the user for a file name. Rather than preparing command files according to the rules presented here, you may wish to have Epsilon write parts of them automatically. Epsilon has two commands that produce the special bind-to-key and define-macro commands appropriate to recreate a current binding or macro. The insert-binding command asks you for a key, and inserts a bind-to-key command into the current buffer. When you load the command buffer, Epsilon will restore the binding of that key. The insert-macro command creates an appropriate define-macro command for a macro whose name you specify, and inserts the command it builds into the current buffer. This comes in handy for editing a keyboard macro that already exists. In addition to the above syntax with commands inside parentheses, command files may contain special lines that define variables, macros, key tables or bindings. Epsilon understands all the different types of lines generated by the list-all and list-colors commands. Let's say you want to create a command file with many different macros or bindings you've defined in the current session. You could type the command file in manually, or you could use the insert-binding and insert-macro commands described above to write the command file line by line. But you may find it easier to run list-all, and then extract just the lines you want. Besides listing variables, macros, key tables, and bindings, the list-all command also creates lines that report that a command or subroutine with a particular name exists. These lines give the name, but not the definition. When Epsilon sees a line like that, it makes sure that a command or subroutine with the given name exists. If not, it reports an error. Epsilon does the same thing with variables that have complicated types (pointers or structures, for example). Standard bindings:
|