unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Nick Helm <nick@tenpoint.co.nz>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: 28843@debbugs.gnu.org
Subject: bug#28843: 26.0.90; gnus kills unsaved message buffer
Date: Wed, 08 Nov 2017 16:49:19 +1300	[thread overview]
Message-ID: <m2k1z1xwe8.fsf@tenpoint.co.nz> (raw)
In-Reply-To: <877ev1xzjf.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Tue, 07 Nov 2017 18:41:24 -0800")

On Tue,  7 Nov 2017 at 18:41:24 -0800, Eric Abrahamsen wrote:

> Nick Helm <nick@tenpoint.co.nz> writes:
>
>> On Thu, 26 Oct 2017 at 13:52:13 +1300, Nick Helm wrote:
>>
>>> On Sun, 15 Oct 2017 at 20:46:25 +1300, Nick Helm wrote:
>>>
>>>> Gnus exits, and the unsaved message buffer dies with it, without prompts
>>>> to save.
>>>
>>> It seems the behaviour is intentional ... This commit changed
>>> `gnus-clear-system' to include this:
>>>
>>>   #+begin_src emacs-lisp
>>>   ;; Kill Gnus buffers.
>>>   (do-auto-save t)
>>>   (dolist (buffer (gnus-buffers))
>>>     (when (gnus-buffer-exists-p buffer)
>>>       (with-current-buffer buffer
>>>   	   (set-buffer-modified-p nil)
>>>   	   (when (local-variable-p 'kill-buffer-hook)
>>>   	     (setq kill-buffer-hook nil))))
>>>     (gnus-kill-buffer buffer))
>>>   #+end_src
>>>
>>> So gnus is at least auto-saving draft messages before zapping them.
>>>
>>> Is there a better way to do this though? I think the user should at
>>> least have some warning that an unsaved buffer is about to be
>>> automatically killed.
>>
>> One solution (though not a very good one IMHO) would be to make the
>> auto-save depend on the user's value of guns-interactive-exit. For
>> example:
>>
>> --- a/lisp/gnus/gnus-start.el	2017-10-26 12:49:43.000000000 +1300
>> +++ b/lisp/gnus/gnus-start.el	2017-10-26 12:45:12.000000000 +1300
>> @@ -731,11 +731,12 @@
>>      (kill-buffer (get-file-buffer (gnus-newsgroup-kill-file nil))))
>>    (gnus-kill-buffer nntp-server-buffer)
>>    ;; Kill Gnus buffers.
>> -  (do-auto-save t)
>>    (dolist (buffer (gnus-buffers))
>>      (when (gnus-buffer-exists-p buffer)
>>        (with-current-buffer buffer
>> -	(set-buffer-modified-p nil)
>> +        (unless gnus-interactive-exit
>> +          (do-auto-save t t)
>> +	(set-buffer-modified-p nil))
>>  	(when (local-variable-p 'kill-buffer-hook)
>>  	  (setq kill-buffer-hook nil))))
>>      (gnus-kill-buffer buffer))
>
> We could also consider mirroring the behavior of Emacs itself: if
> `gnus-interactive-exit' is non-nil, prompt the user whether to save
> changed buffers or not.

Yes, that would be better. 

One way to do that might be to kill unsaved message buffers earlier in
the gnus exit process, say with `gnus-exit-gnus-hook', and rely on
Emacs's standard unsaved buffer query to do `save-buffer' or
`message-dont-send'. Gnus is still running at that point, so it should
save to the drafts group just fine.

Also, the doc for `message-dont-send' says it does an auto-save, but the
code says it actually does `save-buffer'. 





  reply	other threads:[~2017-11-08  3:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-15  7:46 bug#28843: 26.0.90; gnus kills unsaved message buffer Nick Helm
2017-10-26  0:52 ` Nick Helm
2017-11-08  2:28   ` Nick Helm
2017-11-08  2:41     ` Eric Abrahamsen
2017-11-08  3:49       ` Nick Helm [this message]
2017-11-08 16:22         ` Eric Abrahamsen
2018-04-11 21:32         ` Lars Ingebrigtsen
2018-04-11 23:21           ` Nick Helm
2018-04-12 11:36             ` Lars Ingebrigtsen
2018-04-14  3:11               ` Nick Helm
2018-04-14 13:01                 ` Lars Ingebrigtsen
2018-04-14 20:16                   ` Nick Helm
2018-04-15 13:49                     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2k1z1xwe8.fsf@tenpoint.co.nz \
    --to=nick@tenpoint.co.nz \
    --cc=28843@debbugs.gnu.org \
    --cc=eric@ericabrahamsen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).