*** empty log message ***
[gnus] / lisp / gnus-sum.el
index 4c59788..2a94b6b 100644 (file)
@@ -2759,26 +2759,29 @@ If NO-DISPLAY, don't generate a summary buffer."
 
 (defun gnus-thread-loop-p (root thread)
   "Say whether ROOT is in THREAD."
-  (let ((th (cdr thread)))
-    (while (and th
-               (not (eq (caar th) root)))
-      (pop th))
-    (if th
-       ;; We have found a loop.
-       (let (ref-dep)
-         (setcdr thread (delq (car th) (cdr thread)))
-         (if (boundp (setq ref-dep (intern "none"
-                                           gnus-newsgroup-dependencies)))
-             (setcdr (symbol-value ref-dep)
-                     (nconc (cdr (symbol-value ref-dep))
-                            (list (car th))))
-           (set ref-dep (list nil (car th))))
-         1)
-      ;; Recurse down into the sub-threads and look for loops.
-      (apply '+
-            (mapcar
-             (lambda (thread) (gnus-thread-loop-p root thread))
-             (cdr thread))))))
+  (let ((stack (list thread))
+       (infloop 0)
+       th)
+    (while (setq thread (pop stack))
+      (setq th (cdr thread))
+      (while (and th
+                 (not (eq (caar th) root)))
+       (pop th))
+      (if th
+         ;; We have found a loop.
+         (let (ref-dep)
+           (setcdr thread (delq (car th) (cdr thread)))
+           (if (boundp (setq ref-dep (intern "none"
+                                             gnus-newsgroup-dependencies)))
+               (setcdr (symbol-value ref-dep)
+                       (nconc (cdr (symbol-value ref-dep))
+                              (list (car th))))
+             (set ref-dep (list nil (car th))))
+           (setq infloop 1
+                 stack nil))
+       ;; Push all the subthreads onto the stack.
+       (push (cdr thread) stack)))
+    infloop))
 
 (defun gnus-make-threads ()
   "Go through the dependency hashtb and find the roots.         Return all threads."
@@ -2950,10 +2953,10 @@ If NO-DISPLAY, don't generate a summary buffer."
                    article
                    (gnus-data-list t)))))
              ;; Error on the side of excessive subjects.
-             (error (mail-header-subject header)))
+             (error ""))
            (mail-header-subject header))
-          (mail-header-subject header)
-        "")
+          ""
+        (mail-header-subject header))
        nil (cdr (assq article gnus-newsgroup-scored))
        (memq article gnus-newsgroup-processable))
       (when length
@@ -4192,7 +4195,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
            (progn
              (goto-char p)
              (if (search-forward "\nlines: " nil t)
-                 (if (numberp (setq lines (read cur)))
+                 (if (numberp (setq lines (ignore-errors (read cur))))
                      lines 0)
                0))
            ;; Xref.
@@ -6152,9 +6155,9 @@ or `gnus-select-method', no matter what backend the article comes from."
                         (mail-header-number header)))))
       (if header
          (prog1
-             ;; The article is present in the buffer, to we just go to it.
+              ;; The article is present in the buffer, so we just go to it.
              (gnus-summary-goto-article
-              (mail-header-number header) nil header)
+               (mail-header-number header) nil t)
            (when sparse
              (gnus-summary-update-article (mail-header-number header))))
        ;; We fetch the article
@@ -8637,6 +8640,7 @@ save those articles instead."
        (push (cons prev (cdr active)) read))
       (save-excursion
        (set-buffer gnus-group-buffer)
+       (gnus-undo-boundary)
        (gnus-undo-register
          `(progn
             (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
@@ -8676,6 +8680,8 @@ save those articles instead."
         (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
         buffers)))))
 
+(gnus-ems-redefine)
+
 (provide 'gnus-sum)
 
 (run-hooks 'gnus-sum-load-hook)