Jumping to definitions with M-. is wonderful. The downside — everything has a downside — is that it is all too easy to accidentally edit a source file in the Quicklisp distribution.

Here’s what I do. Emacs supports directory-local variables. If you create a file named .dir-locals.el in a directory, Emacs will apply the settings in it to every file in that directory, recursively. You can take advantage of this to make Emacs treat an entire directory as if it were read-only.

In ~/quicklisp/dists/quicklisp, I create a .dir-locals.el file containing one line:

((nil . ((buffer-read-only . t))))

I make this part of my setup on any new development machine (with Stow). Now Emacs will treat all source files in the Quicklisp distribution as read-only.

(If you do find you’ve accidentally edited a file in the Quicklisp distribution, how to fix it? Just delete the project from ~/quicklisp/dists/quicklisp/software/ and quickload it again.)