Leveraging Emacs Introspection

James Cash has an instructive video that shows how to leverage Emacs introspection to solves problems or make simple changes. Cash doesn’t like the way Return behaves when the point is on a list item. The default behavior is simply to start a new line but he’d like it to start a new item.

He’s using evil mode so the keystrokes are different from what a vanilla Emacser is used to but the ideas are the same and the actual key sequences don’t matter. He notes that entering o instead of Return does what he wants so he uses the simplest type of introspection, describe-key (bound to Ctrl+h k), to help solve his problem.

By checking which command is bound to Return and which is bound to o, he’s able to figure out what changes he needs for making the Return functionality behave in the way he desires.

For purposes of the video, he does this by simply making changes directly to the function in question and evaluating it. That’s less than ideal in the real world, of course, but Cash does offer some alternative ways of making the changes.

Regardless, the point of the video is how easy it is to track down where things are happening and fix or change them if you need to. The video is only 10 minutes, 22 seconds so it should be easy to find time for it.

This entry was posted in General and tagged . Bookmark the permalink.