(jed.info)Keyboard Macros


Next: Shells and Shell Commands Prev: Modes Up: Top
Enter node , (file) or (file)node

Keyboard Macros
===============

   JED is able to record a series of keystrokes from the terminal and
replay them.  The saved series of keystrokes is known as a keyboard
macro.  To begin a keyboard macro, simply enter the begin keyboard
macro key sequence which is bound to ^X( if `emacs.sl' is loaded.  To
stop recording the keystrokes, enter ^X).  Then to "execute" the macro,
press ^Xe.  Please note that it is illegal to execute a macro while
defining one and doing so generates an error.  A macro can be aborted at
anytime by pressing the  key.

   One nice feature JED includes is the "macro_query" function.  That
is, while defining a macro, the key sequence ` q' will cause JED to
issue the prompt `Enter String:' in the minibuffer.  Any string that is
entered will be inserted into the buffer and the process of defining the
macro continues. Every time the macro is executed, JED will prompt for
a NEW string to be inserted.

   Any time an error is generated, the process of defining the macro is
aborted as well as execution of the macro.  This is very useful and may
be exploited often.  For example, suppose you want to trim excess
whitespace from the end of ALL lines in a buffer.  Let us also suppose
that the number of lines in the buffer is less than 32000.  Then
consider the following keystrokes:

` ('
     ; begin macro

`'
     ; goto end of line

`ESC \'
     ; trim whitespace

`DOWN'
     ; go down one line

` )'
     ; end macro

Now the macro has been defined.  So move to the top of the buffer and
execute it 32000 times:

              `ESC <'            ; top of buffer
              `ESC 3 2 0 0 0'    ; repeat next command 32000 times
              ` e'             ; execute macro

   If the buffer has less than 32000 lines, the end of the buffer will
be reached and an error will be generated aborting the execution of the
macro.


automatically generated by info2www version 1.2.2.9