X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fnndraft.el;h=f528222dd1662e7c8201b937e09706714d78def2;hb=d96021a8d164856adfa2bfb01dbdd9ff6ce335f5;hp=006348869eff60922576c88c7e593cb62f3830d7;hpb=4c2a7a1c25d5b10316f35f28c972ef3e70225f25;p=gnus diff --git a/lisp/nndraft.el b/lisp/nndraft.el index 006348869..f528222dd 100644 --- a/lisp/nndraft.el +++ b/lisp/nndraft.el @@ -24,14 +24,21 @@ ;;; Code: +;; For Emacs <22.2 and XEmacs. +(eval-and-compile + (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) + (require 'nnheader) (require 'nnmail) (require 'gnus-start) +(require 'gnus-group) (require 'nnmh) (require 'nnoo) (require 'mm-util) (eval-when-compile (require 'cl)) +(declare-function nndraft-request-list "nnmh" (&rest args)) + (nnoo-declare nndraft nnmh) @@ -161,6 +168,25 @@ 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* ((groups (mapcar (lambda (elem) + (gnus-group-prefixed-name (car elem) + (list 'nndraft ""))) + (nnmail-get-active))) + (gnus-group-marked (copy-sequence groups)) + (inhibit-read-only t)) + (gnus-group-get-new-news-this-group nil t) + (dolist (group groups) + (unless (and gnus-permanently-visible-groups + (string-match gnus-permanently-visible-groups + group)) + (gnus-group-goto-group group) + (when (zerop (gnus-group-group-unread)) + (gnus-delete-line))))))) + (deffoo nndraft-request-associate-buffer (group) "Associate the current buffer with some article in the draft group." (nndraft-open-server "") @@ -182,6 +208,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)