Notes on Mastering Emacs: Chapter 4: The Theory of Movement

By Susam Pal on 25 Mar 2023

The following notes were taken while discussing Chapter 4 of the book Mastering Emacs, 2022 edition (written by Mickey Petersen) in book discussion group meetings.

An index of notes for all chapters are available at notes.html.

Contents

Basics

The following complete key sequences illustrate a few basic commands:

In my experience, I have found that ESC ESC ESC is most useful when a stray minibuffer is open but the cursor is on some other buffer instead of the minibuffer and I need to close the minibuffer. Here are some steps that demonstrate this usage:

  1. Type M-x white and pause. We now have a partially typed command in the minibuffer.

  2. Now pretend that we get distracted by some imperfections in the text buffer that was open earlier and we want to fix those first. Type C-x o to move away from the minibuffer and go back to the text buffer to perform some editing tasks.

    In this step, we could have typed C-g to quit the minibuffer first but we did not do that. We pretended to get distracted by the text buffer and went straight to it from the minibuffer by typing C-x o. At this point, the cursor is in the text buffer and the minibuffer remains open at the bottom. The open minibuffer can be distracting while performing the text editing tasks. Typing C-g now will not get rid of the minibuffer because the cursor is no longer in the minibuffer.

  3. Now one way to close the open minibuffer could be to type C-x o to go back to the minibuffer window and type C-g. However, there is a more direct way to do this as explained in the next point.

  4. Type ESC ESC ESC to get rid of the minibuffer at the bottom. This works even when the cursor is not in the minibuffer but is in the text buffer instead.

Major Mode Load Order

The chapter mentions the following order for detecting major mode:

Let us start from the bottom of the list and share some experimental results that illustrate how the major mode detection works.

Occur Mode

TODO: More notes coming up here soon!