If I have some unsaved buffers, when does kill-emacs-hook
call?
Scenario A
kill-emacs
.kill-emacs
operation (C-g
).Scenario B
kill-emacs
.Running kill-emacs-hook
is the first thing which kill-emacs
does.
Both of your scenarios are invalid. If the user directly invokes kill-emacs
the user is not prompted to save buffers (that's only done if save-buffers-kill-emacs
is called).
For the latter, if the user aborts the query to save buffers, or if any of the members of kill-emacs-query-functions
return nil
, then kill-emacs
is never called.