diff options
| author | Lars Ingebrigtsen | 2018-04-15 15:48:44 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2018-04-15 15:48:44 +0200 |
| commit | eceb047cdb33b26422a95c97697ee78f8e3478e3 (patch) | |
| tree | c4afcf017a8d4e9320ccc4646cbe2e038e029b85 | |
| parent | a5f2403cc2d1fb81fa64d2e3650d3a59d47a5637 (diff) | |
| download | emacs-eceb047cdb33b26422a95c97697ee78f8e3478e3.tar.gz emacs-eceb047cdb33b26422a95c97697ee78f8e3478e3.zip | |
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.
| -rw-r--r-- | lisp/gnus/gnus-group.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index b4f482b60a8..1a3646800e9 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." | |||
| 4371 | gnus-expert-user | 4371 | gnus-expert-user |
| 4372 | (gnus-y-or-n-p "Are you sure you want to quit reading news? ")) | 4372 | (gnus-y-or-n-p "Are you sure you want to quit reading news? ")) |
| 4373 | (gnus-run-hooks 'gnus-exit-gnus-hook) | 4373 | (gnus-run-hooks 'gnus-exit-gnus-hook) |
| 4374 | ;; Check whether we have any unsaved Message buffers and offer to | ||
| 4375 | ;; save them. | ||
| 4376 | (gnus--abort-on-unsaved-message-buffers) | ||
| 4374 | ;; Offer to save data from non-quitted summary buffers. | 4377 | ;; Offer to save data from non-quitted summary buffers. |
| 4375 | (gnus-offer-save-summaries) | 4378 | (gnus-offer-save-summaries) |
| 4376 | ;; Save the newsrc file(s). | 4379 | ;; Save the newsrc file(s). |
| @@ -4382,6 +4385,18 @@ The hook `gnus-exit-gnus-hook' is called before actually exiting." | |||
| 4382 | ;; Allow the user to do things after cleaning up. | 4385 | ;; Allow the user to do things after cleaning up. |
| 4383 | (gnus-run-hooks 'gnus-after-exiting-gnus-hook))) | 4386 | (gnus-run-hooks 'gnus-after-exiting-gnus-hook))) |
| 4384 | 4387 | ||
| 4388 | (defun gnus--abort-on-unsaved-message-buffers () | ||
| 4389 | (dolist (buffer (gnus-buffers)) | ||
| 4390 | (when (gnus-buffer-exists-p buffer) | ||
| 4391 | (with-current-buffer buffer | ||
| 4392 | (when (and (derived-mode-p 'message-mode) | ||
| 4393 | (buffer-modified-p) | ||
| 4394 | (not (y-or-n-p | ||
| 4395 | (format "Message buffer %s unsaved, continue exit? " | ||
| 4396 | (buffer-name))))) | ||
| 4397 | (error "Gnus exit aborted due to unsaved %s buffer" | ||
| 4398 | (buffer-name))))))) | ||
| 4399 | |||
| 4385 | (defun gnus-group-quit () | 4400 | (defun gnus-group-quit () |
| 4386 | "Quit reading news without updating .newsrc.eld or .newsrc. | 4401 | "Quit reading news without updating .newsrc.eld or .newsrc. |
| 4387 | The hook `gnus-exit-gnus-hook' is called before actually exiting." | 4402 | The hook `gnus-exit-gnus-hook' is called before actually exiting." |