Abort Gnus exit if we have unsaved Message buffers
* lisp/gnus/gnus-group.el (gnus--abort-on-unsaved-message-buffers): New function (bug#28843). (gnus-group-exit): Use it to abort exit if we have unsaved Message buffers.
This commit is contained in:
parent
a5f2403cc2
commit
eceb047cdb
1 changed files with 15 additions and 0 deletions
|
@ -4371,6 +4371,9 @@ The hook `gnus-exit-gnus-hook' is called before actually exiting."
|
|||
gnus-expert-user
|
||||
(gnus-y-or-n-p "Are you sure you want to quit reading news? "))
|
||||
(gnus-run-hooks 'gnus-exit-gnus-hook)
|
||||
;; Check whether we have any unsaved Message buffers and offer to
|
||||
;; save them.
|
||||
(gnus--abort-on-unsaved-message-buffers)
|
||||
;; Offer to save data from non-quitted summary buffers.
|
||||
(gnus-offer-save-summaries)
|
||||
;; Save the newsrc file(s).
|
||||
|
@ -4382,6 +4385,18 @@ The hook `gnus-exit-gnus-hook' is called before actually exiting."
|
|||
;; Allow the user to do things after cleaning up.
|
||||
(gnus-run-hooks 'gnus-after-exiting-gnus-hook)))
|
||||
|
||||
(defun gnus--abort-on-unsaved-message-buffers ()
|
||||
(dolist (buffer (gnus-buffers))
|
||||
(when (gnus-buffer-exists-p buffer)
|
||||
(with-current-buffer buffer
|
||||
(when (and (derived-mode-p 'message-mode)
|
||||
(buffer-modified-p)
|
||||
(not (y-or-n-p
|
||||
(format "Message buffer %s unsaved, continue exit? "
|
||||
(buffer-name)))))
|
||||
(error "Gnus exit aborted due to unsaved %s buffer"
|
||||
(buffer-name)))))))
|
||||
|
||||
(defun gnus-group-quit ()
|
||||
"Quit reading news without updating .newsrc.eld or .newsrc.
|
||||
The hook `gnus-exit-gnus-hook' is called before actually exiting."
|
||||
|
|
Loading…
Add table
Reference in a new issue