Go to the first, previous, next, last section, table of contents.

Referencing Macros

There is an interesting synergy between Agroups and Emacs keyboard macros. Keyboard macros extend Agroups in a way that we discuss in this chapter and Agroups extends keyboard macros by giving keyboard macros a convenient execution repository. This is no accident and it was part of the design approach of Agroups to capitalize on this synergy along with keys macros to complete the Agroups concept, See section Keyboard Macro Action, See section Keys Macro Action.

The way that Keyboard Macro actions and Keys Macro actions extend Agroups in this regard is to allow the user to create entries that reference other Agroups entries . We refer to these actions when used in this way collectively as referencing macros. There are a few ways that referencing can be used

  1. Referencing macro action entries can reference other groups and entries.
  2. Referencing macro action entries can combine other action entries of different action types.
  3. Referencing macro action entries can reference other referencing macro action entries and hence can be infinitely nested.

The second and third are actually corollaries of the first but are listed since they imply useful concepts in their own right. Notice that the first is true of groups in a general sense which means referencing any group or subgroup. Here is an examples to help illustrate this. Suppose that we create a keyboard macro action whose object keyboard macro slot is composed of

KA s a

Where KA is replaced by its key binding. What does it do? It executes an entry a in a subgroup s of the current group. Let say that the current group in this case was group g and we wanted other groups to be able to execute this action when those other groups are the current group. This can be done by making this entry absolute as follows

KA KG g s a

Now, no matter what group this entry is executed from it will first go absolutely to top level group g then to its subgroup s and then execute action a in that subgroup. Using the keys macro action instead we could more simply do the same thing with the macro

s a

then whether this entry is executed from its containing group or any other groups it would reference relatively within its containing group, in this case being the entry a in subgroup s of top level group g. Note that this would not work as a keyboard macro action since s is only a key binding recognized by Agroups in this particular case and intent.

We could also use the keys macro action to reference another group absolutely. Lets says that in another group other than group g we wanted to reference this action a. We could create the keys macro action in that group as

KG g s a

Now lets get back to illustrating the ways that referencing can be used. This keys macro action illustrates all three

s a s b

This first is that it references action entries in other groups namely subgroup s. The second is that it combines the actions a and b. And the third is that since actions a or b could be yet other keys macro actions it illustrates a potential infinite nesting of referencing.

The biggest problem with such referencing macros is that if one wants to modify the key bindings of an entry then those entries that reference such a modified entry would not work until edited to fix the key references. In a future release of Agroups there will be automatic detection of such points in referencing macros wherever any Agroups key binding is changed. It is known that this can be done for keys macro action entries but it is not clear yet if this can be done for keyboard macro action entries in a general way. In the mean time it may be wise to use keys macro actions for most referencing.

Go to the first, previous, next, last section, table of contents.