On text-only terminals, it is possible to suspend Emacs, which
means stopping Emacs temporarily and returning control to its superior
process, which is usually the shell. This allows you to resume
editing later in the same Emacs process, with the same buffers, the
same kill ring, the same undo history, and so on. To resume Emacs,
use the appropriate command in the parent shell—most likely
fg.
Suspending works only on a terminal device from which the Emacs session was started. We call that device the controlling terminal of the session. Suspending is not allowed if the controlling terminal is a graphical terminal.
Some operating systems do not support suspension of jobs; on these systems, “suspension” actually creates a new shell temporarily as a subprocess of Emacs. Then you would exit the shell to return to Emacs.
This function stops Emacs and returns control to the superior process. If and when the superior process resumes Emacs,
suspend-emacsreturnsnilto its caller in Lisp.This function works only on the controlling terminal of the Emacs session; to relinquish control of other tty devices, use
suspend-tty(see below). If the Emacs session uses more than one terminal, you must delete the frames on all the other terminals before suspending Emacs, or this function signals an error. See Multiple Terminals.If string is non-
nil, its characters are sent to Emacs's superior shell, to be read as terminal input. The characters in string are not echoed by the superior shell; only the results appear.Before suspending,
suspend-emacsruns the normal hooksuspend-hook. After the user resumes Emacs,suspend-emacsruns the normal hooksuspend-resume-hook. See Hooks.The next redisplay after resumption will redraw the entire screen, unless the variable
no-redraw-on-reenteris non-nil. See Refresh Screen.In the following example, note that ‘pwd’ is not echoed after Emacs is suspended. But it is read and executed by the shell.
(suspend-emacs) ⇒ nil (add-hook 'suspend-hook (function (lambda () (or (y-or-n-p "Really suspend? ") (error "Suspend canceled"))))) ⇒ (lambda nil (or (y-or-n-p "Really suspend? ") (error "Suspend canceled"))) (add-hook 'suspend-resume-hook (function (lambda () (message "Resumed!")))) ⇒ (lambda nil (message "Resumed!")) (suspend-emacs "pwd") ⇒ nil ---------- Buffer: Minibuffer ---------- Really suspend? y ---------- Buffer: Minibuffer ---------- ---------- Parent Shell ---------- lewis@slug[23] % /user/lewis/manual lewis@slug[24] % fg ---------- Echo Area ---------- Resumed!
This variable is a normal hook that Emacs runs on resuming after a suspension.
If tty specifies a terminal device used by Emacs, this function relinquishes the device and restores it to its prior state. Frames that used the device continue to exist, but are not updated and Emacs doesn't read input from them. tty can be a terminal object, a frame (meaning the terminal for that frame), or
nil(meaning the terminal for the selected frame). See Multiple Terminals.If tty is already suspended, this function does nothing.
This function runs the hook
suspend-tty-functions, passing the terminal object as an argument to each function.
This function resumes the previously suspended terminal device tty; tty can be a terminal object, a frame (meaning the terminal for that frame), or
nil(meaning the terminal for the selected frame).This function reopens the terminal device, re-initializes it, and redraws its with that terminal's selected frame. It then runs the hook
resume-tty-functions, passing the terminal object as an argument to each function.If the same device is already used by another Emacs terminal, this function signals an error.
This function returns non-
nilif terminal is the controlling terminal of the Emacs session;terminalcan be a terminal object, a frame (meaning the terminal for that frame), ornil(meaning the terminal for the selected frame).
This command suspends a frame. For GUI frames, it calls
iconify-frame(see Visibility of Frames); for text-only frames, it calls eithersuspend-emacsorsuspend-tty, depending on whether the frame is displayed on the controlling terminal device or not.