summaryrefslogtreecommitdiff
path: root/lisp/gnus/nndraft.el
diff options
context:
space:
mode:
authorKatsumi Yamaoka <yamaoka@jpl.org>2011-07-04 01:14:10 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2011-07-04 01:14:10 +0000
commit30b0f2501c5d2ed922a9935cdc239eab1f657ba7 (patch)
tree10938acf0c63ff4c9ce95feebc75840964b26382 /lisp/gnus/nndraft.el
parent3abb79e569258dd1e29e9549718f7e4701c61566 (diff)
downloademacs-30b0f2501c5d2ed922a9935cdc239eab1f657ba7.tar.gz
nndraft.el (nndraft-update-unread-articles): New function.
(nndraft-request-associate-buffer): Use it to update the number of unread articles for the nndraft groups in the group buffer when saving or killing a draft message.
Diffstat (limited to 'lisp/gnus/nndraft.el')
-rw-r--r--lisp/gnus/nndraft.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/gnus/nndraft.el b/lisp/gnus/nndraft.el
index 006348869ef..5275468bb6f 100644
--- a/lisp/gnus/nndraft.el
+++ b/lisp/gnus/nndraft.el
@@ -161,6 +161,16 @@ are generated if and only if they are also in `message-draft-headers'.")
(message-headers-to-generate
nndraft-required-headers message-draft-headers nil))))
+(defun nndraft-update-unread-articles ()
+ "Update groups' unread articles in the group buffer."
+ (nndraft-request-list)
+ (with-current-buffer gnus-group-buffer
+ (let ((gnus-group-marked
+ (mapcar (lambda (elem)
+ (gnus-group-prefixed-name (car elem) (list 'nndraft "")))
+ (nnmail-get-active))))
+ (gnus-group-get-new-news-this-group nil t))))
+
(deffoo nndraft-request-associate-buffer (group)
"Associate the current buffer with some article in the draft group."
(nndraft-open-server "")
@@ -182,6 +192,10 @@ are generated if and only if they are also in `message-draft-headers'.")
'write-contents-hooks)))
(gnus-make-local-hook hook)
(add-hook hook 'nndraft-generate-headers nil t))
+ (gnus-make-local-hook 'after-save-hook)
+ (add-hook 'after-save-hook 'nndraft-update-unread-articles nil t)
+ (message-add-action '(nndraft-update-unread-articles)
+ 'exit 'postpone 'kill)
article))
(deffoo nndraft-request-group (group &optional server dont-check info)