Function: emacs-session-save

This function is called when the window system is shutting down.
If this function returns non-nil, the window system shutdown is canceled.

When a session manager tells Emacs that the window system is shutting
down, this function is called. It calls the functions in the hook
`emacs-save-session-functions'. Functions are called with the current
buffer set to a temporary buffer. Functions should use `insert' to insert
lisp code to save the session state. The buffer is saved in a file in the
home directory of the user running Emacs. The file is evaluated when
Emacs is restarted by the session manager.

If any of the functions returns non-nil, no more functions are called
and this function returns non-nil. This will inform the session manager
that it should abort the window system shutdown.