]> git.eshelyaron.com Git - emacs.git/commitdiff
nndraft.el (nndraft-update-unread-articles): New function.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 4 Jul 2011 01:14:10 +0000 (01:14 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 4 Jul 2011 01:14:10 +0000 (01:14 +0000)
 (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.

lisp/gnus/ChangeLog
lisp/gnus/nndraft.el

index 47b41ffb98b35392a4912eba0c9c21bb47e117cd..45c051c6913675550289643bd9cb4200546dde9d 100644 (file)
@@ -1,3 +1,10 @@
+2011-07-04  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * 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.
+
 2011-07-03  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-group.el (gnus-read-ephemeral-bug-group): Bind the coding
index 006348869eff60922576c88c7e593cb62f3830d7..5275468bb6fc971b1b196bd0a11141ab5bfc82ce 100644 (file)
@@ -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)