GNU bug report logs - #23483
24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down

Previous Next

Package: emacs;

Reported by: "Strozzi, David J." <strozzi2 <at> llnl.gov>

Date: Sun, 8 May 2016 18:19:02 UTC

Severity: wishlist

Found in version 24.5

Done: Ken Brown <kbrown <at> cornell.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ken Brown <kbrown <at> cornell.edu>
Cc: strozzi2 <at> llnl.gov, 23483 <at> debbugs.gnu.org
Subject: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
Date: Tue, 10 May 2016 19:32:26 +0300
> Cc: 23483 <at> debbugs.gnu.org
> From: Ken Brown <kbrown <at> cornell.edu>
> Date: Tue, 10 May 2016 11:16:44 -0400
> 
> > If someone submits patches that listen to system shutdown messages,
> > and auto-save files when they arrive, this can be fixed.  Patches
> > welcome.
> 
> I asked about this on the Cygwin list (https://www.cygwin.com/ml/cygwin/2016-05/msg00085.html).  Based on the response I got, I tried the following, which seems to work:
> 
> diff --git a/src/w32fns.c b/src/w32fns.c
> index ede8f6b..705b978 100644
> --- a/src/w32fns.c
> +++ b/src/w32fns.c
> @@ -4795,6 +4795,9 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
>        my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
>        return 0;
> 
> +    case WM_ENDSESSION:
> +      terminate_due_to_signal (SIGTERM, 0);
> +

Thanks.

However, w32_wnd_proc runs in a separate thread, so I don't think you
can safely call terminate_due_to_signal from there, because the latter
will call Lisp.  IOW, the above can crash in "interesting" ways.

What I think we need to do instead is send a message to the main
thread that will produce a special event, and then bind that event to
kill-emacs (probably in special-event-map).




This bug report was last modified 9 years and 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.