(gnus-summary-select-article): Fix type error in checking the original article buffer.
[gnus] / lisp / gnus-sum.el
index a6569be..ca540b0 100644 (file)
@@ -6190,7 +6190,13 @@ The resulting hash table is returned, or nil if no Xrefs were found."
         (info (nth 2 entry))
         (active (gnus-active group))
         range)
-    (when entry
+    (if (not entry)
+       ;; Group that Gnus doesn't know exists, but still allow the
+       ;; backend to set marks.
+       (gnus-request-set-mark
+        group (list (list (gnus-compress-sequence (sort articles #'<))
+                          'add '(read))))
+      ;; Normal, subscribed groups.
       (setq range (gnus-compute-read-articles group articles))
       (with-current-buffer gnus-group-buffer
        (gnus-undo-register
@@ -6942,7 +6948,9 @@ displayed, no centering will be performed."
 ;; Various summary commands
 
 (defun gnus-summary-select-article-buffer ()
-  "Reconfigure windows to show the article buffer."
+  "Reconfigure windows to show the article buffer.
+If `gnus-widen-article-buffer' is set, show only the article
+buffer."
   (interactive)
   (if (not (gnus-buffer-live-p gnus-article-buffer))
       (error "There is no article buffer for this summary buffer")
@@ -7584,7 +7592,8 @@ be displayed."
                       (null (get-buffer gnus-article-buffer))
                       (not (eq article (cdr gnus-article-current)))
                       (not (equal (car gnus-article-current)
-                                  gnus-newsgroup-name))))
+                                  gnus-newsgroup-name))
+                      (not (get-buffer gnus-original-article-buffer))))
              (and (not gnus-single-article-buffer)
                   (or (null gnus-current-article)
                       (not (eq gnus-current-article article))))
@@ -10277,15 +10286,25 @@ groups."
          (delete-region (match-beginning 1) (match-end 1))
          (insert (number-to-string lines))))))
   ;; Replace the article.
-  (let ((buf (current-buffer)))
+  (let ((buf (current-buffer))
+       (article (cdr gnus-article-current))
+       replace-result)
     (with-temp-buffer
       (insert-buffer-substring buf)
-
       (if (and (not read-only)
-              (not (gnus-request-replace-article
-                    (cdr gnus-article-current) (car gnus-article-current)
-                    (current-buffer) t)))
+              (not (setq replace-result
+                         (gnus-request-replace-article
+                          article (car gnus-article-current)
+                          (current-buffer) t))))
          (error "Couldn't replace article")
+       ;; If we got a number back, then that's the new article number
+       ;; for this article.  Otherwise, the article number didn't change.
+       (when (numberp replace-result)
+         (with-current-buffer gnus-summary-buffer
+           (setq gnus-newsgroup-limit (delq article gnus-newsgroup-limit))
+           (gnus-summary-limit gnus-newsgroup-limit)
+           (setq article replace-result)
+           (gnus-summary-goto-subject article t)))
        ;; Update the summary buffer.
        (if (and references
                 (equal (message-tokenize-header references " ")
@@ -10299,29 +10318,21 @@ groups."
                             (point-min) (point-max)))
                      header)
                  (with-temp-buffer
-                   (insert (format "211 %d Article retrieved.\n"
-                                   (cdr gnus-article-current)))
+                   (insert (format "211 %d Article retrieved.\n" article))
                    (insert head)
                    (insert ".\n")
                    (let ((nntp-server-buffer (current-buffer)))
-                     (setq header (car (gnus-get-newsgroup-headers
-                                        nil t))))
+                     (setq header (car (gnus-get-newsgroup-headers nil t))))
                    (with-current-buffer gnus-summary-buffer
-                     (gnus-data-set-header
-                      (gnus-data-find (cdr gnus-article-current))
-                      header)
-                     (gnus-summary-update-article-line
-                      (cdr gnus-article-current) header)
-                     (if (gnus-summary-goto-subject
-                          (cdr gnus-article-current) nil t)
-                         (gnus-summary-update-secondary-mark
-                          (cdr gnus-article-current))))))))
+                     (gnus-data-set-header (gnus-data-find article) header)
+                     (gnus-summary-update-article-line article header)
+                     (if (gnus-summary-goto-subject article nil t)
+                         (gnus-summary-update-secondary-mark article)))))))
          ;; Update threads.
          (set-buffer (or buffer gnus-summary-buffer))
-         (gnus-summary-update-article (cdr gnus-article-current))
-         (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
-             (gnus-summary-update-secondary-mark
-              (cdr gnus-article-current))))
+         (gnus-summary-update-article article)
+         (if (gnus-summary-goto-subject article nil t)
+             (gnus-summary-update-secondary-mark article)))
        ;; Prettify the article buffer again.
        (unless no-highlight
          (with-current-buffer gnus-article-buffer
@@ -10329,8 +10340,7 @@ groups."
            ;;(gnus-run-hooks 'gnus-article-display-hook)
            (set-buffer gnus-original-article-buffer)
            (gnus-request-article
-            (cdr gnus-article-current)
-            (car gnus-article-current) (current-buffer))))
+            article (car gnus-article-current) (current-buffer))))
        ;; Prettify the summary buffer line.
        (when (gnus-visual-p 'summary-highlight 'highlight)
          (gnus-run-hooks 'gnus-visual-mark-article-hook))))))