Partially revert last Gnus merge
[gnus] / lisp / nndraft.el
index 5275468..da50720 100644 (file)
@@ -1,6 +1,6 @@
 ;;; nndraft.el --- draft article access for Gnus
 
-;; Copyright (C) 1995-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2012 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
 
 ;;; 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))
 
+;; The nnoo-import at the end, I think.
+(declare-function nndraft-request-list "nndraft" (&rest args) t)
+
 (nnoo-declare nndraft
   nnmh)
 
@@ -165,11 +173,23 @@ are generated if and only if they are also in `message-draft-headers'.")
   "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))))
+    (let* ((groups (mapcar (lambda (elem)
+                            (gnus-group-prefixed-name (car elem)
+                                                      (list 'nndraft "")))
+                          (nnmail-get-active)))
+          (gnus-group-marked (copy-sequence groups))
+          ;; Don't send delayed articles.
+          (gnus-get-new-news-hook nil)
+          (inhibit-read-only t))
+      (gnus-group-get-new-news-this-group nil t)
+      (save-excursion
+       (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."