Jason Rumney wrote: > Lennart Borgman wrote: >> Thanks. I did a post_msg and it works as I want it now. My concern >> was that data was lost on reboots and logouts (that has happened to >> me). Now it works like for other w32 apps: > > What other w32 apps are you talking about? The Windows programming > guidelines are pretty clear that the only time to interrupt shutdown > is when you are performing an operation that cannot be interrupted - > CD burning is given as an example. In that case you are supposed to > ask the user one Yes/No question about whether they want to abort the > shutdown. I was going to say I am not aware of any other application that throws away data without asking the user at logoff. However a test showed that Thunderbird behaves that way too ;-| I guess we are misunderstanding each other in some way. Let us see if we can clear this out. To see what I mean look Notepad for example. Edit a file without saving the changes and try to log off. You will be prompted by Notepad to save the changes before Notepad exits. And the log off process waits for Notepad to finish. I think that is good behaviour. I am a very surprised about what the Windows programming guideline seems to say. Can you give me a link to it? There is a message named WM_QUERYENDSESSION that I thought was sent for applications to save data. (Though Emacs does not receive this. It is not clear to me why.) > > As I said at the start of the thread, it would be correct for Emacs to > flush its autosave buffers to disk at this point, but not to start > asking all the questions that save-buffers-kill-emacs does. What if > Emacs is on a secondary monitor, and the Graphics driver shuts it off > when it receives the shutdown message? Emacs will be delaying shutdown > waiting for a response, while the user cannot see it. The problem with autosave is that data might be lost if the user happens to use some other tool to edit the files afterwards. Is there some way to discover cases like the one with secondary monitors? Should there perhaps be an option telling what Emacs should do in these situations (with the choices autosave and ask the user to save changed data)? I attach my patch as it looks now. Please try it to see how it works.