Generally, if I have unsaved work Emacs prompts me to save, so I can C-g out then if I fat-finger kill-emacs.
Re:Joining the Church of Emacs
by jrootabega on Tuesday October 04, 2022 @11:02AM
(#33081370)
I think that killing the entire app is jarring enough that it should never happen accidentally, regardless of unsaved work. It would be especially harmful for newer users, since they will find it harder to relax and feel comfortable with Emacs. But even for experienced users, Emacs state that you would want to preserve goes far beyond unsaved edits. Expensive startup computation, open buffers, window arrangement, ongoing rgrep operations, etc.
(setq confirm-kill-emacs 'y-or-n-p) is one of the most important configs to start with, IMO. Or if you don't want to learn/use elisp, the equivalent Customize setting:
Options > Customize Emacs > Top-Level Customization Groups > Convenience > Confirm Kill Emacs