Keyboard Macros in Eclipse

"...is like a dog’s walking on his hind legs. It is not done well: but you are surprised to find it done at all."
        Samuel Johnson—Boswell’s Life of Johnson. (1763).


Users of keyboard macros in Emacs+ should be aware of a few key issues that can influence their behavior.  Eclipse does not support the infrastructure required for keyboard macros to operate seamlessly.  In particular, when the keyboard macro replays key events (text entry, sub-command keys in minibuffer commands, etc.) Eclipse cannot distinguish between the replayed key event and any actual character the user may type on the keyboard during macro execution.  This has three important implications:
  1. Modifier keys (Ctrl, Alt, etc.) can be unintentionally blended with replayed keys.  Emacs+ detects this and interrupts the execution of the macro.  So, it is not just ^G that interrupts the execution but almost any key touch will curtail it.
  2. Because of this, Emacs+ does not permit a key sequence that ends with a key containing a modifier character to invoke a keyboard macro, as it is essentially impossible to lift the fingers off the modifier key before the macro begins executing, resulting in blended playback.  Therefore, for example, use Ctrl-X Ctrl-K A not Ctrl-X Ctrl-K Ctrl-A when giving a keyboard macro a key binding.
  3. Also, when invoking the append-after-execution version (with Ctrl-U), using Ctrl-X ( may cause the pre-append execution to terminate prematurely if the SHIFT key used to type the open parenthesis is inappropriately blended with a replayed text entry key in the body of the macro.  Emacs+ delays the replay of the macro slightly to give the user time to lift their fingers from the keyboard.  This can be avoided entirely by using the (optional) F3 binding (i.e. Ctrl-U F3) or Ctrl-U Alt-X kbd-macro-start to invoke this behavior.
Certain features of Eclipse's specialized editors can impact the creation of keyboard macros.  For example, the Java editor provides options for the auto-closing of parentheses, brackets, strings, etc.  Along with this it adds the convenience of letting the user type the closing syntax, and rather than re-inserting the close it moves forward to the next position.  Unfortunately, Eclipse doesn't expose this in a way Emacs+ can detect, so when defining a keyboard macro, users should avoid typing the closing syntax when it has already been inserted automagically and use Ctrl-F to move over the character instead.

To enable Alt-X execution of a named keyboard macro, the Emacs+ Keyboard Macros category must be present in the list of Executable Command Categories in the Emacs+ Preferences.  If you have modified this list prior to installing Emacs+ 3.x, it may not be present by default.  If it is not, select New and add it from the interface.

Esoterica:  Users unfamiliar with the details of Emacs' keyboard macro commands may find it interesting to know that Emacs+ supports the following feature of kbd-macro-bind-to-key:

To avoid problems caused by overriding existing bindings, the key sequences C-x C-k 0 through C-x C-k 9 and C-x C-k A through C-x C-k Z (except for those bindings already used by the keyboard macro commands) are reserved for your own keyboard macro bindings. In fact, to bind to one of these key sequences, you only need to type the digit or letter rather than the whole key sequences.  For example,

     C-x C-k b 4

will bind the last keyboard macro to the key sequence C-x C-k 4.