Capture It, Name It, Own it: How to capture re-occurring patterns, name them and turn them into reusable functions via Emacs kbd-macros

Unknown author (1992-05)

(**Note: This text was delivered as a lecture to the AI Lab Support Staff and still appears as such.**) This report describes research done at the Artificial Intelligence Laboratory of the Massachusetts Institute of Technology. Support for the laboratory's artificial intelligence research is provided in part by the Advanced Research Projects Agency of the Department of Defense under Office of Naval Research contract N00014-89-J-3202 and by the National Science Foundation under grant number MIP-9001651.

Working Paper

The purpose of this talk is not to teach you about Emacs or Emacs kbd-macros, though we will use both as examples. I can teach you everything there is to know about Emacs and kbd-macros in 5 minutes. There are literally only about six commands which govern the majority of the Emacs kbd-macro universe but just knowing the commands is not going to help you much. To borrow an analogy from the introductory 6.001 lecture, I can teach you all the rules of chess in ten minutes but that does not mean that you will be a good chess player in ten minutes. The purpose of this talk is to get you to think about many of the methods and processes we perform each day in our jobs. Hopefully, such an examination will make you realize that we often repeat the same processes over and over. If we can isolate a repeated process, we can often capture it and transform it into a reusable function. Today we will be looking at capturing such processes via Emacs kbd-macros through, you should be aware that many these of the methods can also be applied to UNIX, other operating systems, editors and languages. The reason we will be examining this topic via Emacs kbd-macros is that it is the easiest and most user-friendly way to approach the subject. We are going to start by looking at very simple examples and progress in complexity. I have written these macros and use some of them on a daily basis. Hopefully some these examples will directly correlate to duties you perform each day at work and you will be able to use some of them.