Temporarily Suspending Emacs

In most cases, you can stop Emacs temporarily by typing C-z. If you use a character terminal, you arrive at the UNIX prompt. To get back into Emacs, type either fg (if the shell has job control) or exit (if your shell uses a subshell to simulate job control). If you’re not sure about the capabilities of the shell you’re using, or if you’re a new user and don’t yet understand what job control means, it won’t hurt to try both of these commands. One will work; the other will give you a harmless error message.

If you’re running X and press C-z, you’ll get a different result. The Emacs window turns into an icon (probably either a gnu or an overflowing kitchen sink). If you click open the icon, the Emacs window is back again. [27]

When you return to Emacs, you’ll see that everything is exactly as you left it. The same files are displayed on the screen, in exactly the same states. You don’t even have to save your files before suspending Emacs; you can wait until after you return. Suspending Emacs quickly can be handy if you’re working on something top secret like a surprise party, and the person to be surprised strolls into your office. Having said this, we heartily recommend that you do save your files first. No one knows what will happen while you’re gone: you may forget and go to lunch, the computer may crash in the meantime, and you’ll lose a lot of work.

It’s extremely useful to be able to suspend Emacs and do something else for a while, especially if ...

Get Learning GNU Emacs, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.