* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
@ 2016-05-08 13:33 Strozzi, David J.
2016-05-08 18:40 ` Eli Zaretskii
0 siblings, 1 reply; 15+ messages in thread
From: Strozzi, David J. @ 2016-05-08 13:33 UTC (permalink / raw)
To: 23483
[-- Attachment #1: Type: text/plain, Size: 6208 bytes --]
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))
[-- Attachment #2: Type: text/html, Size: 12039 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-08 13:33 bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down Strozzi, David J.
@ 2016-05-08 18:40 ` Eli Zaretskii
2016-05-10 15:16 ` Ken Brown
0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2016-05-08 18:40 UTC (permalink / raw)
To: Strozzi, David J.; +Cc: 23483
> From: "Strozzi, David J." <strozzi2@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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-08 18:40 ` Eli Zaretskii
@ 2016-05-10 15:16 ` Ken Brown
2016-05-10 16:32 ` Eli Zaretskii
0 siblings, 1 reply; 15+ messages in thread
From: Ken Brown @ 2016-05-10 15:16 UTC (permalink / raw)
To: Eli Zaretskii, Strozzi, David J.; +Cc: 23483
On 5/8/2016 2:40 PM, Eli Zaretskii wrote:
>> From: "Strozzi, David J." <strozzi2@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
^ permalink raw reply related [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-10 15:16 ` Ken Brown
@ 2016-05-10 16:32 ` Eli Zaretskii
2016-05-12 13:57 ` Ken Brown
0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2016-05-10 16:32 UTC (permalink / raw)
To: Ken Brown; +Cc: strozzi2, 23483
> Cc: 23483@debbugs.gnu.org
> From: Ken Brown <kbrown@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).
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-10 16:32 ` Eli Zaretskii
@ 2016-05-12 13:57 ` Ken Brown
2016-05-12 16:56 ` Eli Zaretskii
0 siblings, 1 reply; 15+ messages in thread
From: Ken Brown @ 2016-05-12 13:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: strozzi2, 23483
[-- Attachment #1: Type: text/plain, Size: 287 bytes --]
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
[-- Attachment #2: endsession.patch --]
[-- Type: text/plain, Size: 2730 bytes --]
diff --git a/src/keyboard.c b/src/keyboard.c
index 92d5c30..fe04b3f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3893,6 +3893,16 @@ kbd_buffer_get_event (KBOARD **kbp,
kbd_fetch_ptr = event + 1;
}
#endif
+
+#ifdef HAVE_NTGUI
+ else if (event->kind == END_SESSION_EVENT)
+ {
+ /* Make an event (end-session). */
+ obj = list1 (Qend_session);
+ kbd_fetch_ptr = event + 1;
+ }
+#endif
+
#if defined (HAVE_X11) || defined (HAVE_NTGUI) \
|| defined (HAVE_NS)
else if (event->kind == ICONIFY_EVENT)
@@ -10984,6 +10994,7 @@ syms_of_keyboard (void)
#ifdef HAVE_NTGUI
DEFSYM (Qlanguage_change, "language-change");
+ DEFSYM (Qend_session, "end-session");
#endif
#ifdef HAVE_DBUS
@@ -11758,6 +11769,10 @@ keys_of_keyboard (void)
initial_define_lispy_key (Vspecial_event_map, "delete-frame",
"handle-delete-frame");
+#ifdef HAVE_NTGUI
+ initial_define_lispy_key (Vspecial_event_map, "end-session",
+ "kill-emacs");
+#endif
initial_define_lispy_key (Vspecial_event_map, "ns-put-working-text",
"ns-put-working-text");
initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text",
diff --git a/src/termhooks.h b/src/termhooks.h
index d21d6ce..ff74d99 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -158,6 +158,9 @@ enum event_kind
SELECTION_CLEAR_EVENT, /* Another X client cleared our selection. */
BUFFER_SWITCH_EVENT, /* A process filter has switched buffers. */
DELETE_WINDOW_EVENT, /* An X client said "delete this window". */
+#ifdef HAVE_NTGUI
+ END_SESSION_EVENT, /* The user is logging out or shutting down. */
+#endif
MENU_BAR_EVENT, /* An event generated by the menu bar.
The frame_or_window field's cdr holds the
Lisp-level event value.
diff --git a/src/w32fns.c b/src/w32fns.c
index ede8f6b..7a1f84a 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4795,6 +4795,11 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
return 0;
+ case WM_ENDSESSION:
+ my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
+ /* If we return, the process will be terminated immediately. */
+ sleep (1000);
+
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. */
diff --git a/src/w32term.c b/src/w32term.c
index 74ea6b5..72e1245 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5260,6 +5260,10 @@ w32_read_socket (struct terminal *terminal,
}
break;
+ case WM_ENDSESSION:
+ inev.kind = END_SESSION_EVENT;
+ break;
+
case WM_INITMENU:
f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
^ permalink raw reply related [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-12 13:57 ` Ken Brown
@ 2016-05-12 16:56 ` Eli Zaretskii
2016-05-12 19:58 ` Ken Brown
0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2016-05-12 16:56 UTC (permalink / raw)
To: Ken Brown; +Cc: strozzi2, 23483
> Cc: strozzi2@llnl.gov, 23483@debbugs.gnu.org
> From: Ken Brown <kbrown@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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-12 16:56 ` Eli Zaretskii
@ 2016-05-12 19:58 ` Ken Brown
2016-05-13 16:22 ` Strozzi, David J.
0 siblings, 1 reply; 15+ messages in thread
From: Ken Brown @ 2016-05-12 19:58 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 23483-done, strozzi2
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-12 19:58 ` Ken Brown
@ 2016-05-13 16:22 ` Strozzi, David J.
2016-05-13 17:46 ` Eli Zaretskii
0 siblings, 1 reply; 15+ messages in thread
From: Strozzi, David J. @ 2016-05-13 16:22 UTC (permalink / raw)
To: Ken Brown, Eli Zaretskii; +Cc: 23483-done@debbugs.gnu.org
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@cornell.edu]
Sent: Thursday, May 12, 2016 12:58 PM
To: Eli Zaretskii
Cc: Strozzi, David J.; 23483-done@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
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-13 16:22 ` Strozzi, David J.
@ 2016-05-13 17:46 ` Eli Zaretskii
2016-05-13 18:05 ` Ken Brown
2016-05-13 20:02 ` Strozzi, David J.
0 siblings, 2 replies; 15+ messages in thread
From: Eli Zaretskii @ 2016-05-13 17:46 UTC (permalink / raw)
To: Strozzi, David J.; +Cc: 23483
> From: "Strozzi, David J." <strozzi2@llnl.gov>
> CC: "23483-done@debbugs.gnu.org" <23483-done@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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-13 17:46 ` Eli Zaretskii
@ 2016-05-13 18:05 ` Ken Brown
2016-05-13 20:02 ` Strozzi, David J.
1 sibling, 0 replies; 15+ messages in thread
From: Ken Brown @ 2016-05-13 18:05 UTC (permalink / raw)
To: Eli Zaretskii, Strozzi, David J.; +Cc: 23483
On 5/13/2016 1:46 PM, Eli Zaretskii wrote:
>> From: "Strozzi, David J." <strozzi2@llnl.gov>
>> CC: "23483-done@debbugs.gnu.org" <23483-done@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
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-13 17:46 ` Eli Zaretskii
2016-05-13 18:05 ` Ken Brown
@ 2016-05-13 20:02 ` Strozzi, David J.
2016-05-13 23:12 ` Ken Brown
2016-05-14 7:22 ` Eli Zaretskii
1 sibling, 2 replies; 15+ messages in thread
From: Strozzi, David J. @ 2016-05-13 20:02 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 23483@debbugs.gnu.org
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@gnu.org]
Sent: Friday, May 13, 2016 10:47 AM
To: Strozzi, David J.
Cc: kbrown@cornell.edu; 23483@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@llnl.gov>
> CC: "23483-done@debbugs.gnu.org" <23483-done@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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-13 20:02 ` Strozzi, David J.
@ 2016-05-13 23:12 ` Ken Brown
2016-05-14 7:56 ` Eli Zaretskii
2016-05-14 7:22 ` Eli Zaretskii
1 sibling, 1 reply; 15+ messages in thread
From: Ken Brown @ 2016-05-13 23:12 UTC (permalink / raw)
To: Strozzi, David J., Eli Zaretskii; +Cc: 23483@debbugs.gnu.org
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-13 20:02 ` Strozzi, David J.
2016-05-13 23:12 ` Ken Brown
@ 2016-05-14 7:22 ` Eli Zaretskii
2016-05-14 20:02 ` Strozzi, David J.
1 sibling, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2016-05-14 7:22 UTC (permalink / raw)
To: Strozzi, David J.; +Cc: 23483
> From: "Strozzi, David J." <strozzi2@llnl.gov>
> CC: "kbrown@cornell.edu" <kbrown@cornell.edu>, "23483@debbugs.gnu.org"
> <23483@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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-13 23:12 ` Ken Brown
@ 2016-05-14 7:56 ` Eli Zaretskii
0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2016-05-14 7:56 UTC (permalink / raw)
To: Ken Brown; +Cc: strozzi2, 23483
> Cc: "23483@debbugs.gnu.org" <23483@debbugs.gnu.org>
> From: Ken Brown <kbrown@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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
2016-05-14 7:22 ` Eli Zaretskii
@ 2016-05-14 20:02 ` Strozzi, David J.
0 siblings, 0 replies; 15+ messages in thread
From: Strozzi, David J. @ 2016-05-14 20:02 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 23483@debbugs.gnu.org
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@gnu.org]
Sent: Saturday, May 14, 2016 12:22 AM
To: Strozzi, David J.
Cc: kbrown@cornell.edu; 23483@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@llnl.gov>
> CC: "kbrown@cornell.edu" <kbrown@cornell.edu>, "23483@debbugs.gnu.org"
> <23483@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.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2016-05-14 20:02 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-08 13:33 bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down Strozzi, David J.
2016-05-08 18:40 ` Eli Zaretskii
2016-05-10 15:16 ` Ken Brown
2016-05-10 16:32 ` Eli Zaretskii
2016-05-12 13:57 ` Ken Brown
2016-05-12 16:56 ` Eli Zaretskii
2016-05-12 19:58 ` Ken Brown
2016-05-13 16:22 ` Strozzi, David J.
2016-05-13 17:46 ` Eli Zaretskii
2016-05-13 18:05 ` Ken Brown
2016-05-13 20:02 ` Strozzi, David J.
2016-05-13 23:12 ` Ken Brown
2016-05-14 7:56 ` Eli Zaretskii
2016-05-14 7:22 ` Eli Zaretskii
2016-05-14 20:02 ` Strozzi, David J.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).