Bind RET and TAB on images for better UX.
[gnus] / lisp / gnus-start.el
index 5621954..2af55fc 100644 (file)
@@ -1677,14 +1677,16 @@ If SCAN, request a scan of that group as well."
   (let* ((newsrc (cdr gnus-newsrc-alist))
         (alevel (or level gnus-activate-level (1+ gnus-level-subscribed)))
         (foreign-level
-         (min
-          (cond ((and gnus-activate-foreign-newsgroups
-                      (not (numberp gnus-activate-foreign-newsgroups)))
-                 (1+ gnus-level-subscribed))
-                ((numberp gnus-activate-foreign-newsgroups)
-                 gnus-activate-foreign-newsgroups)
-                (t 0))
-          alevel))
+         (or
+          level
+          (min
+           (cond ((and gnus-activate-foreign-newsgroups
+                       (not (numberp gnus-activate-foreign-newsgroups)))
+                  (1+ gnus-level-subscribed))
+                 ((numberp gnus-activate-foreign-newsgroups)
+                  gnus-activate-foreign-newsgroups)
+                 (t 0))
+           alevel)))
         (methods-cache nil)
         (type-cache nil)
         (gnus-agent-article-local-times 0)
@@ -1734,8 +1736,13 @@ If SCAN, request a scan of that group as well."
                'foreign)))
        (push (setq method-group-list (list method method-type nil))
              type-cache))
-      (setcar (nthcdr 2 method-group-list)
-             (cons info (nth 2 method-group-list))))
+      ;; Only add groups that need updating.
+      (when (<= (gnus-info-level info)
+               (if (eq (cadr method-group-list) 'foreign)
+                   foreign-level
+                 alevel))
+       (setcar (nthcdr 2 method-group-list)
+               (cons info (nth 2 method-group-list)))))
 
     ;; Sort the methods based so that the primary and secondary
     ;; methods come first.  This is done for legacy reasons to try to
@@ -1753,19 +1760,13 @@ If SCAN, request a scan of that group as well."
            infos (nth 2 (car type-cache)))
       (pop type-cache)
 
-      (when method
+      (when (and method
+                infos)
        ;; See if any of the groups from this method require updating.
-       (when (block nil
-               (dolist (info infos)
-                 (when (<= (gnus-info-level info)
-                           (if (eq method-type 'foreign)
-                               foreign-level
-                             alevel))
-                   (return t))))
-         (gnus-read-active-for-groups method infos)
-         (dolist (info infos)
-           (inline (gnus-get-unread-articles-in-group
-                    info (gnus-active (gnus-info-group info))))))))
+       (gnus-read-active-for-groups method infos)
+       (dolist (info infos)
+         (inline (gnus-get-unread-articles-in-group
+                  info (gnus-active (gnus-info-group info)))))))
     (gnus-message 6 "Checking new news...done")))
 
 (defun gnus-method-rank (type method)
@@ -1793,6 +1794,8 @@ If SCAN, request a scan of that group as well."
   (with-current-buffer nntp-server-buffer
     (cond
      ((gnus-check-backend-function 'retrieve-groups (car method))
+      (when (gnus-check-backend-function 'request-scan (car method))
+       (gnus-request-scan nil method))
       (gnus-read-active-file-2
        (mapcar (lambda (info)
                 (gnus-group-real-name (gnus-info-group info)))