exit-emacs(2)exit-emacs - Exit MicroEmacs
n exit-emacs [exitCode]
Exit MicroEmacs back to the operating system. If no argument n is given and there are any unwritten, changed buffers, the editor prompts the user to discard changes.
The numeric argument n is used to modify the default behavior of the command, where the bits are defined as follows:
0x01
0x02
0x04
0x08
0x10
0x20
If an argument of 0 is specified then MicroEmacs exits immediately.
exit-emacs may be used to reproduce the behavior of save-buffers-exit-emacs(2) and quick-exit(2) as follows:
3 exit-emacs == save-buffers-exit-emacs 2 exit-emacs == quick-exit
If the macro shut-down(3) is defined then it is invoked by the editor when it is closed. A user defined shutdown action may be associated with the close operation. It is the callers responsibility that the macro terminates correctly otherwise the editor will hang.
All buffers with a name starting with a '*' are assumed to be system buffers (i.e. *scratch*) and are not saved.
Modes 8 and 16 may be used where the user wishes to discard edited buffers on exiting and does not want to confirm the exit. Dictionaries should be configured to auto-save in user-setup(3).
An emergency exit command which forces the editor to quit may be implemented as 0x28 exit-emacs i.e. Force quit and exit with failed status. Internally this is what MicroEmacs uses to perform an emergency quit operation caused by signal fault etc.
Ref: exit-emacs(2) File: m2cmd049.2 Date: 2026/08/20
(c) Copyright JASSPA 2026