[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master eceb047: Abort Gnus exit if we have unsaved Message
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master eceb047: Abort Gnus exit if we have unsaved Message buffers |
Date: |
Sun, 15 Apr 2018 09:49:28 -0400 (EDT) |
branch: master
commit eceb047cdb33b26422a95c97697ee78f8e3478e3
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
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.
---
lisp/gnus/gnus-group.el | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index b4f482b..1a36468 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -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."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master eceb047: Abort Gnus exit if we have unsaved Message buffers,
Lars Ingebrigtsen <=