Skip to main content

The Craft of Emacs

Types, errors and control flow

30 minutes

Our xx command is technically correct, but it clearly has a few holes in it. Not only are we able to input any string, when we do so we get a nonsensical answer.

In this chapter we’ll make our code more robust. We’ll begin by hunting down the source of the error with the *scratch* buffer. Once we’ve found it we’ll explore some new techniques to patch it up: logical tests and the if special form. Finally, we’ll neaten up our code with the handy special form of let*.

Our code at the end won’t do anything more than it does currently, but it will work far better and be easier on the eyes.

Learning objectives