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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23483 in the body.
You can then email your comments to 23483 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Sun, 08 May 2016 18:19:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Strozzi, David J." <strozzi2 <at> llnl.gov>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 08 May 2016 18:19:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 24.5; cygwin emacs w32 doesn not ask to save files when windows
 shuts down
Date: Sun, 8 May 2016 13:33:11 +0000
[Message part 1 (text/plain, inline)]
I am running the Windows 32 native emacs build that is part of cygwin.
Running on Windows 7.  When I shut down windows (from the Start Menu),
emacs does not ask to save edited files.  That means I lose work unless
I remember to separately quit emancs manually before shutting down.

Not a big deal, but can it be fixed?

Thanks.

In GNU Emacs 24.5.1 (x86_64-unknown-cygwin)
of 2015-06-23 on desktop-new
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure
--srcdir=/home/kbrown/src/cygemacs/emacs-24.5-2.x86_64/src/emacs-24.5
--prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc
--docdir=/usr/share/doc/emacs --htmldir=/usr/share/doc/emacs/html -C
--with-w32 'CFLAGS=-ggdb -O2 -pipe -Wimplicit-function-declaration
-fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.5-2.x86_64/build=/usr/src/debug/emacs-24.5-2
-fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.5-2.x86_64/src/emacs-24.5=/usr/src/debug/emacs-24.5-2'
CPPFLAGS= LDFLAGS='

Important settings:
  locale-coding-system: nil

Major mode: Fundamental

Minor modes in effect:
  recentf-mode: t
  global-linum-mode: t
  linum-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Encrypting /cygdrive/c/Users/strozzi2/.cacher/mellon_16feb16_llnl.gpg... [3 times]
Wrote /cygdrive/c/Users/strozzi2/.cacher/mellon_16feb16_llnl.gpg [2 times]
Mark saved where search started
Mark set [2 times]
Mark saved where search started
Mark set
Read-Only mode enabled
Mark saved where search started
Mark set [2 times]
Read-Only mode disabled

Load-path shadows:
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/tex-site hides /usr/share/emacs/site-lisp/tex-site
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/auctex hides /usr/share/emacs/site-lisp/auctex
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/toolbar-x hides /usr/share/emacs/site-lisp/auctex/toolbar-x
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/texmathp hides /usr/share/emacs/site-lisp/auctex/texmathp
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/tex hides /usr/share/emacs/site-lisp/auctex/tex
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/tex-style hides /usr/share/emacs/site-lisp/auctex/tex-style
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/tex-mik hides /usr/share/emacs/site-lisp/auctex/tex-mik
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/tex-jp hides /usr/share/emacs/site-lisp/auctex/tex-jp
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/tex-info hides /usr/share/emacs/site-lisp/auctex/tex-info
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/tex-font hides /usr/share/emacs/site-lisp/auctex/tex-font
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/tex-fold hides /usr/share/emacs/site-lisp/auctex/tex-fold
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/tex-buf hides /usr/share/emacs/site-lisp/auctex/tex-buf
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/tex-bar hides /usr/share/emacs/site-lisp/auctex/tex-bar
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/prv-emacs hides /usr/share/emacs/site-lisp/auctex/prv-emacs
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/preview hides /usr/share/emacs/site-lisp/auctex/preview
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/plain-tex hides /usr/share/emacs/site-lisp/auctex/plain-tex
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/multi-prompt hides /usr/share/emacs/site-lisp/auctex/multi-prompt
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/latex hides /usr/share/emacs/site-lisp/auctex/latex
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/font-latex hides /usr/share/emacs/site-lisp/auctex/font-latex
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/context hides /usr/share/emacs/site-lisp/auctex/context
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/context-nl hides /usr/share/emacs/site-lisp/auctex/context-nl
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/context-en hides /usr/share/emacs/site-lisp/auctex/context-en
/cygdrive/c/Users/strozzi2/.emacs.d/elpa/auctex-11.88.8/bib-cite hides /usr/share/emacs/site-lisp/auctex/bib-cite

Features:
(shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils epa-file epa
derived epg browse-url url-util url-parse auth-source eieio byte-opt
bytecomp byte-compile cl-extra cconv eieio-core gnus-util mm-util
help-fns mail-prsvr password-cache url-vars misearch multi-isearch info
tex-site package epg-config setup-cygwin cygwin-mount ange-ftp comint
ansi-color ring edmacro kmacro recentf tree-widget wid-edit cl-loaddefs
cl-lib easymenu server linum time-date tooltip electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel w32-common-fns disp-table
w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind gfilenotify w32 multi-tty emacs)

Memory information:
((conses 16 305859 30398)
(symbols 48 25221 0)
(miscs 40 328 390)
(strings 32 37818 9581)
(string-bytes 1 1002066)
(vectors 16 35864)
(vector-slots 8 1129009 101036)
(floats 8 81 576)
(intervals 56 515 375)
(buffers 960 14))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Sun, 08 May 2016 18:41:01 GMT) Full text and rfc822 format available.

Message #8 received at 23483 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Strozzi\, David J." <strozzi2 <at> llnl.gov>
Cc: 23483 <at> debbugs.gnu.org
Subject: Re: bug#23483: 24.5;
 cygwin emacs w32 doesn not ask to save files when windows shuts down
Date: Sun, 08 May 2016 21:40:40 +0300
> From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
> Date: Sun, 8 May 2016 13:33:11 +0000
> 
> I am running the Windows 32 native emacs build that is part of cygwin.
> Running on Windows 7. When I shut down windows (from the Start Menu),
> emacs does not ask to save edited files. That means I lose work unless
> I remember to separately quit emancs manually before shutting down.
> Not a big deal, but can it be fixed?

If someone submits patches that listen to system shutdown messages,
and auto-save files when they arrive, this can be fixed.  Patches
welcome.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Tue, 10 May 2016 15:17:03 GMT) Full text and rfc822 format available.

Message #11 received at 23483 <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>, "Strozzi, David J." <strozzi2 <at> llnl.gov>
Cc: 23483 <at> debbugs.gnu.org
Subject: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Tue, 10 May 2016 11:16:44 -0400
On 5/8/2016 2:40 PM, Eli Zaretskii wrote:
>> From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
>> Date: Sun, 8 May 2016 13:33:11 +0000
>>
>> I am running the Windows 32 native emacs build that is part of cygwin.
>> Running on Windows 7. When I shut down windows (from the Start Menu),
>> emacs does not ask to save edited files. That means I lose work unless
>> I remember to separately quit emancs manually before shutting down.
>> Not a big deal, but can it be fixed?
> 
> 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);
+
     case WM_WINDOWPOSCHANGING:
       /* Don't restrict the sizing of any kind of frames.  If the window
         manager doesn't, there's no reason to do it ourselves.  */


Ken





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Tue, 10 May 2016 16:33:01 GMT) Full text and rfc822 format available.

Message #14 received at 23483 <at> debbugs.gnu.org (full text, mbox):

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: Re: 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).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Thu, 12 May 2016 13:59:01 GMT) Full text and rfc822 format available.

Message #17 received at 23483 <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: strozzi2 <at> llnl.gov, 23483 <at> debbugs.gnu.org
Subject: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Thu, 12 May 2016 09:57:58 -0400
[Message part 1 (text/plain, inline)]
On 5/10/2016 12:32 PM, Eli Zaretskii wrote:
> 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).

Thanks.  My attempt to implement this is attached.

Ken

[endsession.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Thu, 12 May 2016 16:57:01 GMT) Full text and rfc822 format available.

Message #20 received at 23483 <at> debbugs.gnu.org (full text, mbox):

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: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Thu, 12 May 2016 19:56:44 +0300
> Cc: strozzi2 <at> llnl.gov, 23483 <at> debbugs.gnu.org
> From: Ken Brown <kbrown <at> cornell.edu>
> Date: Thu, 12 May 2016 09:57:58 -0400
> 
> On 5/10/2016 12:32 PM, Eli Zaretskii wrote:
> > 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).
> 
> Thanks.  My attempt to implement this is attached.

Thanks.

Did you try this when some of the buffers have unsaved changes?  I'm
thinking about questions Emacs might ask then.

If that is not a problem, feel free to commit to master.




Reply sent to Ken Brown <kbrown <at> cornell.edu>:
You have taken responsibility. (Thu, 12 May 2016 19:59:02 GMT) Full text and rfc822 format available.

Notification sent to "Strozzi, David J." <strozzi2 <at> llnl.gov>:
bug acknowledged by developer. (Thu, 12 May 2016 19:59:02 GMT) Full text and rfc822 format available.

Message #25 received at 23483-done <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 23483-done <at> debbugs.gnu.org, strozzi2 <at> llnl.gov
Subject: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Thu, 12 May 2016 15:58:24 -0400
On 5/12/2016 12:56 PM, Eli Zaretskii wrote:
> Did you try this when some of the buffers have unsaved changes?  I'm
> thinking about questions Emacs might ask then.

Yes, I tried it.  Emacs just auto-saved the changed buffers with no 
questions asked.

> If that is not a problem, feel free to commit to master.

Done as git commit 6435f41.  Thanks for your help, Eli.

Closing.

Ken





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Fri, 13 May 2016 16:23:02 GMT) Full text and rfc822 format available.

Message #28 received at 23483-done <at> debbugs.gnu.org (full text, mbox):

From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
To: Ken Brown <kbrown <at> cornell.edu>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "23483-done <at> debbugs.gnu.org" <23483-done <at> debbugs.gnu.org>
Subject: RE: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Fri, 13 May 2016 16:22:43 +0000
Hi folks,

Thanks for addressing this!  The usual behavior of windows programs on restart or shutdown is to ask the user to save unsaved files, rather than saving them silently.  The current patch to save automatically is better than losing data, but prompting the user I think would be the best thing.  Or even having emacs abort the shutdown and give a message like "emacs cancelled shutdown due to unsaved files."

Dave

-----Original Message-----
From: Ken Brown [mailto:kbrown <at> cornell.edu] 
Sent: Thursday, May 12, 2016 12:58 PM
To: Eli Zaretskii
Cc: Strozzi, David J.; 23483-done <at> debbugs.gnu.org
Subject: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down

On 5/12/2016 12:56 PM, Eli Zaretskii wrote:
> Did you try this when some of the buffers have unsaved changes?  I'm 
> thinking about questions Emacs might ask then.

Yes, I tried it.  Emacs just auto-saved the changed buffers with no questions asked.

> If that is not a problem, feel free to commit to master.

Done as git commit 6435f41.  Thanks for your help, Eli.

Closing.

Ken





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Fri, 13 May 2016 17:47:01 GMT) Full text and rfc822 format available.

Message #31 received at 23483 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Strozzi\, David J." <strozzi2 <at> llnl.gov>
Cc: kbrown <at> cornell.edu, 23483 <at> debbugs.gnu.org
Subject: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Fri, 13 May 2016 20:46:47 +0300
> From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
> CC: "23483-done <at> debbugs.gnu.org" <23483-done <at> debbugs.gnu.org>
> Date: Fri, 13 May 2016 16:22:43 +0000
> 
> Thanks for addressing this!  The usual behavior of windows programs on restart or shutdown is to ask the user to save unsaved files, rather than saving them silently.  The current patch to save automatically is better than losing data, but prompting the user I think would be the best thing.  Or even having emacs abort the shutdown and give a message like "emacs cancelled shutdown due to unsaved files."

The patch doesn't save files automatically, it performs "auto-save",
which saves the modified buffers into separate files, from which you
can restore afterwards.

FWIW, I don't see why asking the user would be better.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Fri, 13 May 2016 18:06:01 GMT) Full text and rfc822 format available.

Message #34 received at 23483 <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>, "Strozzi, David J." <strozzi2 <at> llnl.gov>
Cc: 23483 <at> debbugs.gnu.org
Subject: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Fri, 13 May 2016 14:05:22 -0400
On 5/13/2016 1:46 PM, Eli Zaretskii wrote:
>> From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
>> CC: "23483-done <at> debbugs.gnu.org" <23483-done <at> debbugs.gnu.org>
>> Date: Fri, 13 May 2016 16:22:43 +0000
>>
>> Thanks for addressing this!  The usual behavior of windows programs on restart or shutdown is to ask the user to save unsaved files, rather than saving them silently.  The current patch to save automatically is better than losing data, but prompting the user I think would be the best thing.  Or even having emacs abort the shutdown and give a message like "emacs cancelled shutdown due to unsaved files."
>
> The patch doesn't save files automatically, it performs "auto-save",
> which saves the modified buffers into separate files, from which you
> can restore afterwards.
>
> FWIW, I don't see why asking the user would be better.

Agreed.  I would just add that the next time you try to edit one of the 
affected files, Emacs will warn you that there's an auto-save file and 
will suggest that you consider running M-x recover-this-file.

Ken





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Fri, 13 May 2016 20:40:02 GMT) Full text and rfc822 format available.

Message #37 received at 23483 <at> debbugs.gnu.org (full text, mbox):

From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "kbrown <at> cornell.edu" <kbrown <at> cornell.edu>,
 "23483 <at> debbugs.gnu.org" <23483 <at> debbugs.gnu.org>
Subject: RE: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Fri, 13 May 2016 20:02:08 +0000
Hmmm, this doesn't sound like a great fix.  It's really a "failsafe", but not what Windows users expect.  When you open the file again, how will you know that there's another auto-save file?  Will emacs tell you?  What if you open the file in another program?  Or you're editing source code / script and then make / run it, nothing will tell you about the auto-saved file.

Perhaps better is to have emacs simply abort a restart / shutdown and require the user to manually close emacs.  If it doesn't behave like other windows programs (query user to save unsaved files), then we have to remember emacs is special.  You could have a parameter for whether emacs aborts a windows shutdown, default to yes, and then users and consciously shut it off if they want.

Dave

-----Original Message-----
From: Eli Zaretskii [mailto:eliz <at> gnu.org] 
Sent: Friday, May 13, 2016 10:47 AM
To: Strozzi, David J.
Cc: kbrown <at> cornell.edu; 23483 <at> debbugs.gnu.org
Subject: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down

> From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
> CC: "23483-done <at> debbugs.gnu.org" <23483-done <at> debbugs.gnu.org>
> Date: Fri, 13 May 2016 16:22:43 +0000
> 
> Thanks for addressing this!  The usual behavior of windows programs on restart or shutdown is to ask the user to save unsaved files, rather than saving them silently.  The current patch to save automatically is better than losing data, but prompting the user I think would be the best thing.  Or even having emacs abort the shutdown and give a message like "emacs cancelled shutdown due to unsaved files."

The patch doesn't save files automatically, it performs "auto-save", which saves the modified buffers into separate files, from which you can restore afterwards.

FWIW, I don't see why asking the user would be better.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Fri, 13 May 2016 23:13:02 GMT) Full text and rfc822 format available.

Message #40 received at 23483 <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: "Strozzi, David J." <strozzi2 <at> llnl.gov>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "23483 <at> debbugs.gnu.org" <23483 <at> debbugs.gnu.org>
Subject: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Fri, 13 May 2016 19:12:14 -0400
On 5/13/2016 4:02 PM, Strozzi, David J. wrote:
> Hmmm, this doesn't sound like a great fix.  It's really a "failsafe", but not what Windows users expect.  When you open the file again, how will you know that there's another auto-save file?  Will emacs tell you?  What if you open the file in another program?  Or you're editing source code / script and then make / run it, nothing will tell you about the auto-saved file.
>
> Perhaps better is to have emacs simply abort a restart / shutdown and require the user to manually close emacs.  If it doesn't behave like other windows programs (query user to save unsaved files), then we have to remember emacs is special.  You could have a parameter for whether emacs aborts a windows shutdown, default to yes, and then users and consciously shut it off if they want.

I'm not convinced that this is better.  But as an experiment, I decided 
to see if I could make emacs do what you want by having a system 
shutdown trigger 'save-buffers-kill-emacs' instead of 'kill-emacs'. 
What happened was that Windows complained that emacs was preventing it 
from shutting down, and it gave me the choice of shutting down anyway or 
canceling the shutdown.  I chose the latter, at which point I was faced 
with a non-responsive emacs that had to be killed.

I don't have any further ideas.

Ken




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Sat, 14 May 2016 07:24:02 GMT) Full text and rfc822 format available.

Message #43 received at 23483 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Strozzi\, David J." <strozzi2 <at> llnl.gov>
Cc: kbrown <at> cornell.edu, 23483 <at> debbugs.gnu.org
Subject: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Sat, 14 May 2016 10:22:34 +0300
> From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
> CC: "kbrown <at> cornell.edu" <kbrown <at> cornell.edu>, "23483 <at> debbugs.gnu.org"
> 	<23483 <at> debbugs.gnu.org>
> Date: Fri, 13 May 2016 20:02:08 +0000
> 
> Hmmm, this doesn't sound like a great fix.  It's really a "failsafe", but not what Windows users expect.

Windows users expect that a program either asks or silently does The
Right Thing.  Emacs will now do the latter.  I don't see why we should
emulate annoying behavior of programs that insist on asking.  I have
always hated to answer gobs of these questions when I restart a busy
system.  Most of those questions are redundant anyway, e.g., if I
change the size of a column in an Excel spreadsheet.

> When you open the file again, how will you know that there's another auto-save file?  Will emacs tell you?

Yes, Emacs will tell you the file has auto-saved changes, and will
propose a command to restore them.

> What if you open the file in another program? Or you're editing source code / script and then make / run it, nothing will tell you about the auto-saved file.

But the system didn't just go down on its own, at least that's not
what happens frequently.  _You_ shut it down, so why won't you restore
the files after it comes up (or save them before you shut down) in the
first place?  It makes very little sense to me.

> Perhaps better is to have emacs simply abort a restart / shutdown and require the user to manually close emacs.

No, this is even worse.  When I want to restart my system, I want it
to come up quickly enough, and I frequently turn to other things while
it restarts.

> If it doesn't behave like other windows programs (query user to save unsaved files), then we have to remember emacs is special.  You could have a parameter for whether emacs aborts a windows shutdown, default to yes, and then users and consciously shut it off if they want.

The feature that got coded is a safety feature, a kind of fire escape.
Normally, you are expected to shut down Emacs before you turn off the
system.  For a "fire escape", having an option that controls it makes
no sense to me, because safety features should be always active.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Sat, 14 May 2016 07:57:01 GMT) Full text and rfc822 format available.

Message #46 received at 23483 <at> debbugs.gnu.org (full text, mbox):

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: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Sat, 14 May 2016 10:56:42 +0300
> Cc: "23483 <at> debbugs.gnu.org" <23483 <at> debbugs.gnu.org>
> From: Ken Brown <kbrown <at> cornell.edu>
> Date: Fri, 13 May 2016 19:12:14 -0400
> 
> > Perhaps better is to have emacs simply abort a restart / shutdown and require the user to manually close emacs.  If it doesn't behave like other windows programs (query user to save unsaved files), then we have to remember emacs is special.  You could have a parameter for whether emacs aborts a windows shutdown, default to yes, and then users and consciously shut it off if they want.
> 
> I'm not convinced that this is better.  But as an experiment, I decided 
> to see if I could make emacs do what you want by having a system 
> shutdown trigger 'save-buffers-kill-emacs' instead of 'kill-emacs'. 
> What happened was that Windows complained that emacs was preventing it 
> from shutting down, and it gave me the choice of shutting down anyway or 
> canceling the shutdown.  I chose the latter, at which point I was faced 
> with a non-responsive emacs that had to be killed.
> 
> I don't have any further ideas.

AFAIK, doing what David wants is tricky technically (because our
message pump runs in a separate thread, which cannot run Lisp), and is
IMO not important enough for us to try getting out of our way.  Like I
said, having to answer all those questions always annoys me.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23483; Package emacs. (Sat, 14 May 2016 20:03:01 GMT) Full text and rfc822 format available.

Message #49 received at 23483 <at> debbugs.gnu.org (full text, mbox):

From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "kbrown <at> cornell.edu" <kbrown <at> cornell.edu>,
 "23483 <at> debbugs.gnu.org" <23483 <at> debbugs.gnu.org>
Subject: RE: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files
 when windows shuts down
Date: Sat, 14 May 2016 20:02:08 +0000
Hi,

I appreciate your viewpoint, and am glad the current improvement was made.  You should feel free to close this issue and move on, but let me just say:

When _you_ quit a windows program, it asks you to save changes.  Emacs does this too, when you quit with C-x C-c. or click on the X in the upper-right corner of the window.  When _Windows_ closes a program as part of restart / shutdown / logout, it behaves the same way.  Except for emacs.  Maybe this is what I find unsettling: "I quit the program" and "Windows quits the program" behave the same way for all programs I use, except emacs.

So, what would you think about emacs doing C-x C-c when windows tells it to quit?

The advantage of the typical Windows-shutdown behavior is I can tell windows to shut down, and each program will prompt me if anything's changed, else is silently quits.  Much faster than me manually switching to and quitting every program.

Dave

________________________________________
From: Eli Zaretskii [eliz <at> gnu.org]
Sent: Saturday, May 14, 2016 12:22 AM
To: Strozzi, David J.
Cc: kbrown <at> cornell.edu; 23483 <at> debbugs.gnu.org
Subject: Re: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down

> From: "Strozzi, David J." <strozzi2 <at> llnl.gov>
> CC: "kbrown <at> cornell.edu" <kbrown <at> cornell.edu>, "23483 <at> debbugs.gnu.org"
>       <23483 <at> debbugs.gnu.org>
> Date: Fri, 13 May 2016 20:02:08 +0000
>
> Hmmm, this doesn't sound like a great fix.  It's really a "failsafe", but not what Windows users expect.

Windows users expect that a program either asks or silently does The
Right Thing.  Emacs will now do the latter.  I don't see why we should
emulate annoying behavior of programs that insist on asking.  I have
always hated to answer gobs of these questions when I restart a busy
system.  Most of those questions are redundant anyway, e.g., if I
change the size of a column in an Excel spreadsheet.

> When you open the file again, how will you know that there's another auto-save file?  Will emacs tell you?

Yes, Emacs will tell you the file has auto-saved changes, and will
propose a command to restore them.

> What if you open the file in another program? Or you're editing source code / script and then make / run it, nothing will tell you about the auto-saved file.

But the system didn't just go down on its own, at least that's not
what happens frequently.  _You_ shut it down, so why won't you restore
the files after it comes up (or save them before you shut down) in the
first place?  It makes very little sense to me.

> Perhaps better is to have emacs simply abort a restart / shutdown and require the user to manually close emacs.

No, this is even worse.  When I want to restart my system, I want it
to come up quickly enough, and I frequently turn to other things while
it restarts.

> If it doesn't behave like other windows programs (query user to save unsaved files), then we have to remember emacs is special.  You could have a parameter for whether emacs aborts a windows shutdown, default to yes, and then users and consciously shut it off if they want.

The feature that got coded is a safety feature, a kind of fire escape.
Normally, you are expected to shut down Emacs before you turn off the
system.  For a "fire escape", having an option that controls it makes
no sense to me, because safety features should be always active.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 12 Jun 2016 11:24:03 GMT) Full text and rfc822 format available.

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

Previous Next


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