See the Emacs manual, node Exiting. There you'll see this:
If the value of the variable confirm-kill-emacs
is non-nil
, C-x C-c
assumes that its value is a predicate function, and calls that
function. If the result of the function call is non-nil
, the session
is killed, otherwise Emacs continues to run. One convenient function to
use as the value of confirm-kill-emacs
is the function yes-or-no-p
.
The default value of confirm-kill-emacs
is nil
.
To kill Emacs without being prompted about saving, type M-x
kill-emacs
.
And you can bind kill-emacs
to any key (including to C-x C-c
).