Subject: Re: bug#7837: 23.2.91; Logging out is confusing if Emacs has background processes running

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 03 Oct 2019 17:33:09 +0200

Reuben Thomas <[email-masked]> writes:

> https://www.x.org/releases/X11R7.7/doc/libSM/xsmp.html
>
> Emacs already implements this: see src/xsmfns.c. The problem is its behaviour
> when there are background processes.

I guess it's this code?

DEFUN ("handle-save-session", Fhandle_save_session,
       Shandle_save_session, 1, 1, "e",
       doc: /* Handle the save_yourself event from a session manager.
A session manager can tell Emacs that the window system is shutting down
by sending Emacs a save_yourself message.  Emacs executes this function when
such an event occurs.  This function then executes `emacs-session-save'.

[...]

  else if (kill_emacs)
    {
      /* We should not do user interaction here, but it is not easy to
         prevent.  Fix this in next version.  */
      Fkill_emacs (Qnil);

I started a background process that `C-x C-c' will query me about before
exiting, but calling `kill-emacs' directly will kill Emacs without
querying about those processes.

Is there a different path being taken when Emacs gets this event from
the system?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no