|
|
coherent
me/Read_me 10/11/90 Flexible bindings and emacs programming. The new emacs has two tables for keybindings an old table which is loaded at compile time and is never changed, and a new table which can be modified by the new keybinding commands. The following new commands are implemented. ctl-x m Renames the curent macro ctl-x E to a new binding. The current macro must be defned. This function asks for a new binding (such as ESC z or ctl-f) the current macro is renamed to the new binding. Example: ctl-x ( ESC s xyz ctl-u ctl-d ctl-x ) /* define macro */ ctl-x m esc l /* rename it esc l */ ctl-x r Requests an old binding and a new binding. The new binding takes on the meaning of the old binding. If the two bindings are the same the new binding is deleted. Examples: ctl-x r esc l esc l /* undefine previous example */ ctl-x r ctl-x c ctl-z /* exchange meanings of */ ctl-x r ctl-z ctl-x c /* ctl-z and ctl-x c */ Note from the second example the old binding table is never changed so the exchange works. If you connect to Coherent via some utility such as kermit you may find that emacs doesn't understand your arrow keys. Flexible binding can often fix that. ctl-x r ctl-p (up arrow) ctl-x r ctl-n (down arrow) /* this may kill esc b */ ctl-x r ctl-b (left arrow) /* this may kill esc c */ ctl-x r ctl-f (right arrow) /* this may kill esc d */ ctl-x s Requests a file name and saves all flexible bindings to that file. If the current macro is completely defined it is also saved. A special macro called the initialization macro is also saved. ctl-x l Requests a file name and reloads all flexible bindings from it. The initialization macro is loaded but not executed. ctl-x x Rebinds prefix key ctl-x, provides two new prefix keys and rebinds ctl-u. Asks for each prefix key or space. Space leaves existing binding. Then it asks for a new binding for ctl-u. -f filename This is an argv parameter. The filename is loaded and after all other listed files are loaded the initialization macro is executed. ctl-x i Rebinds the current macro to the initialization macro. Note if you have some edit sequence to execute on a number of files create it, executeing some meaningless binding such as esc Z at the end. Rebind esc Z to ctl-z. Rebind the current macro to the initialization macro. Save the flexabile bindings to some file. Now use the Coherent do loop to run the initilaization macro on all the files you wish changed. ctl-u -1 some macro The repeat count of -1 for executing a macro means execute the macro until it fails then return success. Emacs programming example. Bulid a macro that finds instances of xyz and deletes the next four characters. Use that macro on a list of files. ctl-x ( esc s xyz [ret] ctl-u ctl-d ctl-x ) /* define the macro */ ctl-x m esc a /* name it esc a */ ctl-x ( ctl-u -1 [ret] esc a esc z ctl-x ) /* macro with meaningless esc z */ ctl-x i /* make it init mac */ ctl-x r ctl-z esc z /* esc z = ctl-z */ ctl-x s myfile.rc /* save bindings */ ctl-z /* exit */ me -f myfile.rc datafile.x Notes: ctl-x m and ctl-x r both check that the new name is not ctl-x r. Changing the binding of ctl-x r would alow the user to paint himself into a corner. Earlier documents gave the argv of -b. There is an emacs -b for backup version. I therefore used -f to designate flex binding files. if -f is not specified emacs checks for a flexable bindings file. On Coherent this is presumed to be at $HOME/.emacs.rc On atari and Ms-Dos $LIBPATH\emacs.rc For a complete list of all the keybindings in emacs. Look at bind.doc which is produced by ext.c during the make process.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.