*** empty log message ***
[gnus] / lisp / gnus-sum.el
index 193a62d..e89da4b 100644 (file)
@@ -714,6 +714,7 @@ mark:    The articles mark."
 ;;; Internal variables
 
 (defvar gnus-scores-exclude-files nil)
+(defvar gnus-page-broken nil)
 
 (defvar gnus-original-article nil)
 (defvar gnus-article-internal-prepare-hook nil)
@@ -1854,7 +1855,7 @@ The following commands are available:
   (make-local-variable 'gnus-summary-line-format-spec)
   (make-local-variable 'gnus-summary-mark-positions)
   (make-local-hook 'post-command-hook)
-  (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
+  (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
   (run-hooks 'gnus-summary-mode-hook)
   (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
   (gnus-update-summary-mark-positions))
@@ -2758,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."
@@ -2949,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
@@ -3816,7 +3820,7 @@ If READ-ALL is non-nil, all articles in the group are selected."
       ;; All articles have to be subsets of the active articles.
       (cond
        ;; Adjust "simple" lists.
-       ((memq mark '(tick dormant expirable reply save))
+       ((memq mark '(tick dormant expire reply save))
        (while articles
          (when (or (< (setq article (pop articles)) min) (> article max))
            (set var (delq article (symbol-value var))))))
@@ -4191,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.
@@ -4866,7 +4870,7 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
       (run-hooks 'gnus-exit-group-hook)
       (gnus-summary-update-info))
     (gnus-close-group group)
-    ;; Make sure where I was, and go to next newsgroup.
+    ;; Make sure where we were, and go to next newsgroup.
     (set-buffer gnus-group-buffer)
     (unless quit-config
       (gnus-group-jump-to-group group))
@@ -5127,8 +5131,9 @@ previous group instead."
          (progn
            (gnus-message 5 "Returning to the group buffer")
            (setq entered t)
-           (set-buffer current-buffer)
-           (gnus-summary-exit)
+           (when (gnus-buffer-live-p current-buffer)
+             (set-buffer current-buffer)
+             (gnus-summary-exit))
            (run-hooks 'gnus-group-no-more-groups-hook))
        ;; We try to enter the target group.
        (gnus-group-jump-to-group target-group)
@@ -6131,9 +6136,11 @@ Return how many articles were fetched."
       (gnus-summary-position-point)
       n)))
 
-(defun gnus-summary-refer-article (message-id)
-  "Fetch an article specified by MESSAGE-ID."
-  (interactive "sMessage-ID: ")
+(defun gnus-summary-refer-article (message-id &optional arg)
+  "Fetch an article specified by MESSAGE-ID.
+If ARG (the prefix), fetch the article using `gnus-refer-article-method'
+or `gnus-select-method', no matter what backend the article comes from."
+  (interactive "sMessage-ID: \nP")
   (when (and (stringp message-id)
             (not (zerop (length message-id))))
     ;; Construct the correct Message-ID if necessary.
@@ -6155,8 +6162,11 @@ Return how many articles were fetched."
              (gnus-summary-update-article (mail-header-number header))))
        ;; We fetch the article
        (let ((gnus-override-method
-              (and (gnus-news-group-p gnus-newsgroup-name)
-                   gnus-refer-article-method))
+              (cond ((gnus-news-group-p gnus-newsgroup-name)
+                     gnus-refer-article-method)
+                    (arg
+                     (or gnus-refer-article-method gnus-select-method))
+                    (t nil)))
              number)
          ;; Start the special refer-article method, if necessary.
          (when (and gnus-refer-article-method
@@ -6428,7 +6438,7 @@ article.  If BACKWARD (the prefix) is non-nil, search backward instead."
   (gnus-eval-in-buffer-window gnus-article-buffer
     (widen)
     (goto-char (point-min))
-    (when gnus-break-pages
+    (when gnus-page-broken
       (gnus-narrow-to-page))))
 
 (defun gnus-summary-end-of-article ()
@@ -6441,7 +6451,7 @@ article.  If BACKWARD (the prefix) is non-nil, search backward instead."
     (widen)
     (goto-char (point-max))
     (recenter -3)
-    (when gnus-break-pages
+    (when gnus-page-broken
       (gnus-narrow-to-page))))
 
 (defun gnus-summary-print-article (&optional filename)
@@ -6478,10 +6488,10 @@ article massaging functions being run."
          gnus-article-display-hook
          gnus-article-prepare-hook
          gnus-break-pages
+         gnus-show-mime
          gnus-visual)
       (gnus-summary-select-article nil 'force)))
   (gnus-summary-goto-subject gnus-current-article)
-                                       ;  (gnus-configure-windows 'article)
   (gnus-summary-position-point))
 
 (defun gnus-summary-verbose-headers (&optional arg)
@@ -6753,7 +6763,12 @@ and `request-accept' functions."
                  ;; Copy the marks to other group.
                  (gnus-add-marked-articles
                   to-group (cdar marks) (list to-article) info))
-               (setq marks (cdr marks)))))
+               (setq marks (cdr marks)))
+
+             (gnus-dribble-enter
+              (concat "(gnus-group-set-info '"
+                      (gnus-prin1-to-string (gnus-get-info to-group))
+                      ")"))))
 
          ;; Update the Xref header in this article to point to
          ;; the new crossposted article we have just created.
@@ -6771,7 +6786,11 @@ and `request-accept' functions."
       (gnus-summary-remove-process-mark article))
     ;; Re-activate all groups that have been moved to.
     (while to-groups
-      (gnus-activate-group (pop to-groups)))
+      (save-excursion
+       (set-buffer gnus-group-buffer)
+       (when (gnus-group-goto-group (car to-groups) t)
+         (gnus-group-get-new-news-this-group 1))
+       (pop to-groups)))
 
     (gnus-kill-buffer copy-buf)
     (gnus-summary-position-point)
@@ -8660,6 +8679,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)