* gnus-start.el (gnus-get-unread-articles): Inline gnus-server-get-method.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 30 Dec 2003 03:58:14 +0000 (03:58 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 30 Dec 2003 03:58:14 +0000 (03:58 +0000)
(gnus-get-unread-articles): Cache methods.
(gnus-get-unread-articles-in-group): Indent.

lisp/ChangeLog
lisp/gnus-group.el
lisp/gnus-start.el
lisp/gnus.el

index 93bee48..7d937e0 100644 (file)
@@ -4,8 +4,13 @@
 
 2003-12-30  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-start.el (gnus-get-unread-articles): Inline gnus-server-get-method.
+       (gnus-get-unread-articles): Cache methods.
+       (gnus-get-unread-articles-in-group): Indent.
+
        * gnus.el (gnus-version-number): Bump.
        (gnus-secondary-method-p): Extend servers to methods before comparing.
+       (gnus-secondary-method-p): Revert.
 
 2003-12-30 Lars Magne Ingebrigtsen <lars@ingebrigtsen.no>
 
index a1bd82e..353d351 100644 (file)
@@ -1464,7 +1464,7 @@ if it is a string, only list groups matching REGEXP."
         (active (gnus-active group))
         (total (if active (1+ (- (cdr active) (car active))) 0))
         (info (nth 2 entry))
-        (method (gnus-server-get-method group (gnus-info-method info)))
+        (method (inline (gnus-server-get-method group (gnus-info-method info))))
         (marked (gnus-info-marks info))
         (mailp (apply 'append
                       (mapcar
index c1c5091..cec0656 100644 (file)
@@ -1532,7 +1532,7 @@ newsgroup."
       ;; If the agent is enabled, we may have to alter the active info.
       (when (and gnus-agent info)
        (gnus-agent-possibly-alter-active
-                (gnus-info-group info) active))
+        (gnus-info-group info) active))
 
       ;; Modify the list of read articles according to what articles
       ;; are available; then tally the unread articles and add the
@@ -1620,7 +1620,10 @@ newsgroup."
                  gnus-activate-foreign-newsgroups)
                 (t 0))
           level))
-        scanned-methods info group active method retrieve-groups)
+        (methods-cache nil)
+        (type-cache nil)
+        scanned-methods info group active method retrieve-groups cmethod
+        method-type)
     (gnus-message 6 "Checking new news...")
 
     (while newsrc
@@ -1639,12 +1642,25 @@ newsgroup."
       ;; nil for non-foreign groups that the user has requested not be checked
       ;; t for unchecked foreign groups or bogus groups, or groups that can't
       ;;   be checked, for one reason or other.
-      (if (and (setq method (gnus-info-method info))
-              (not (inline
-                     (gnus-server-equal
-                      gnus-select-method
-                      (setq method (gnus-server-get-method nil method)))))
-              (not (gnus-secondary-method-p method)))
+      (when (setq method (gnus-info-method info))
+       (if (setq cmethod (assoc method methods-cache))
+           (setq method (cdr cmethod))
+         (setq cmethod (inline (gnus-server-get-method nil method)))
+         (push (cons method cmethod) methods-cache)
+         (setq method cmethod)))
+      (when (and method
+                (not (setq method-type (cdr (assoc method type-cache)))))
+       (setq method-type
+             (cond
+              ((gnus-secondary-method-p method)
+               'secondary)
+              ((inline (gnus-server-equal gnus-select-method method))
+               'primary)
+              (t
+               'foreign)))
+       (push (cons method method-type) type-cache))
+      (if (and method
+              (eq method-type 'foreign))
          ;; These groups are foreign.  Check the level.
          (when (and (<= (gnus-info-level info) foreign-level)
                     (setq active (gnus-activate-group group 'scan)))
index e6c56ad..6b33e45 100644 (file)
@@ -3490,11 +3490,11 @@ You should probably use `gnus-find-method-for-group' instead."
 (defsubst gnus-secondary-method-p (method)
   "Return whether METHOD is a secondary select method."
   (let ((methods gnus-secondary-select-methods)
-       (gmethod (gnus-server-get-method nil method)))
+       (gmethod (inline (gnus-server-get-method nil method))))
     (while (and methods
                (not (gnus-method-equal
-                     (gnus-server-get-method nil (car methods))
-                     (gnus-server-get-method nil gmethod))))
+                     (inline (gnus-server-get-method nil (car methods)))
+                     gmethod)))
       (setq methods (cdr methods)))
     methods))