]> git.eshelyaron.com Git - emacs.git/commitdiff
Introduce summary-local variable gnus-newsgroup-selection
authorAndrew G Cohen <cohen@andy.bu.edu>
Thu, 27 Apr 2017 07:15:24 +0000 (15:15 +0800)
committerAndrew G Cohen <cohen@andy.bu.edu>
Thu, 27 Apr 2017 07:27:00 +0000 (15:27 +0800)
* lisp/gnus/gnus-sum.el (gnus-newsgroup-selection): Introduce a new
gnus-summary-local-variable to hold an nnselect article list.
* lisp/gnus/nnselect.el: Use the summary-local variable where
appropriate.

lisp/gnus/gnus-sum.el
lisp/gnus/nnir.el
lisp/gnus/nnselect.el

index 3cb4784931f83ace502459f9c55b7f320a15aede..1072fe21dde3c66dab015a0f76f798807230d774 100644 (file)
@@ -1571,7 +1571,7 @@ This list will always be a subset of gnus-newsgroup-undownloaded.")
 
 (defvar gnus-newsgroup-sparse nil)
 
-(defvar nnselect-artlist nil)
+(defvar gnus-newsgroup-selection nil)
 
 (defvar gnus-current-article nil)
 (defvar gnus-article-current nil)
@@ -1607,7 +1607,7 @@ This list will always be a subset of gnus-newsgroup-undownloaded.")
     gnus-newsgroup-undownloaded
     gnus-newsgroup-unsendable
 
-    nnselect-artlist
+    gnus-newsgroup-selection
 
     gnus-newsgroup-begin gnus-newsgroup-end
     gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
index 727df8ed45b5af70290a6bea53119542fcb3d64a..525e7ed0bb1de511e554e0066288deb712c8e2be 100644 (file)
@@ -499,8 +499,8 @@ ready to be added to the list of search results."
     ;; and with all subsequent slashes replaced by dots
     (let ((group (replace-regexp-in-string
                  "[/\\]" "."
-                 (replace-regexp-in-string "^[./\\]" "" dirnam nil t)
-                 nil t)))
+                  (replace-regexp-in-string "^[./\\]" "" dirnam nil t)
+                  nil t)))
 
     (vector (gnus-group-full-name group server)
            (if (string-match "\\`nnmaildir:" (gnus-group-server server))
index 52f3c903229fdb59d11e61060c4ca653b58693bf..52aa5a8b2c2d6685bc80876806d5247893dd6842 100644 (file)
@@ -71,8 +71,8 @@
 (defvar gnus-inhibit-demon)
 (defvar gnus-message-group-art)
 
-;; (defvar nnselect-artlist nil
-;;   "Internal: stores the list of articles.")
+(defvar nnselect-artlist nil
+  "Internal: stores the list of articles.")
 
 
 ;; For future use
 
 (defmacro nnselect-article-group (article)
   "Return the group for ARTICLE."
-  `(nnselect-artitem-group (nnselect-artlist-article nnselect-artlist ,article)))
+  `(nnselect-artitem-group (nnselect-artlist-article
+  gnus-newsgroup-selection ,article)))
 
 (defmacro nnselect-article-number (article)
   "Return the number for ARTICLE."
-  `(nnselect-artitem-number (nnselect-artlist-article nnselect-artlist ,article)))
+  `(nnselect-artitem-number (nnselect-artlist-article
+  gnus-newsgroup-selection ,article)))
 
 (defmacro nnselect-article-rsv (article)
   "Return the rsv for ARTICLE."
-  `(nnselect-artitem-rsv (nnselect-artlist-article nnselect-artlist ,article)))
+  `(nnselect-artitem-rsv (nnselect-artlist-article
+  gnus-newsgroup-selection ,article)))
 
 (defmacro nnselect-article-id (article)
   "Return the pair `(nnselect id . real id)' of ARTICLE."
@@ -224,6 +227,7 @@ If this variable is nil, or if the provided function returns nil,
   nnselect-artlist)
 
 (deffoo nnselect-retrieve-headers (articles &optional _group _server fetch-old)
+  (setq gnus-newsgroup-selection nnselect-artlist)
   (let ((gnus-inhibit-demon t)
        (gartids (ids-by-group articles))
        headers)
@@ -266,27 +270,29 @@ If this variable is nil, or if the provided function returns nil,
 
 (declare-function nnir-run-query "nnir" (specs))
 (deffoo nnselect-request-article (article &optional group server to-buffer)
-  (nnselect-possibly-change-group group server)
   ;; We shoud only arrive here if we are in an nnselect group and we
   ;; are requesting a real article. Just find the originating
   ;; group for the article and pass the request on.
   (if (numberp article)
-      (unless (zerop (nnselect-artlist-length nnselect-artlist))
-       (let ((artgroup (nnselect-article-group article))
-             (artnumber (nnselect-article-number article)))
-         (message "Requesting article %d from group %s"
-                  artnumber artgroup)
-         (if to-buffer
-             (with-current-buffer to-buffer
-               (let ((gnus-article-decode-hook nil))
-                 (gnus-request-article-this-buffer artnumber artgroup)))
-           (gnus-request-article artnumber artgroup))
-         (cons artgroup artnumber)))
+      (with-current-buffer gnus-summary-buffer
+       (unless (zerop (nnselect-artlist-length
+                       gnus-newsgroup-selection))
+         (let ((artgroup (nnselect-article-group article))
+               (artnumber (nnselect-article-number article)))
+           (message "Requesting article %d from group %s"
+                    artnumber artgroup)
+           (if to-buffer
+               (with-current-buffer to-buffer
+                 (let ((gnus-article-decode-hook nil))
+                   (gnus-request-article-this-buffer artnumber artgroup)))
+             (gnus-request-article artnumber artgroup))
+           (cons artgroup artnumber))))
     (let (articleno)
       (save-excursion
         ;; if we are coming from an nnimap group we can search the
         ;; whole server. Its usually so fast we might as well. If we
         ;; want we could make this configurable.
+       ;; (or (string-empty-p server (gnus-virtual-group-p server))
         (when (eq 'nnimap (car (gnus-server-to-method server)))
           (let ((article article)
                (gnus-override-method (gnus-server-to-method server))
@@ -321,10 +327,6 @@ If this variable is nil, or if the provided function returns nil,
                ;; up a server or group method and retrieve the
                ;; original article id that way.
 
-              ;; (gnus-command-method
-               ;; (gnus-find-method-for-group (when (not (zerop
-               ;; (nnir-artlist-length nnir-artlist)))
-               ;; (nnir-article-group (or articleno 1))))))
               (gnus-command-method
                (if (zerop (nnselect-artlist-length nnselect-artlist))
                    (or (gnus-server-to-method server)
@@ -433,13 +435,15 @@ If this variable is nil, or if the provided function returns nil,
     car cadr)))
 
 (deffoo nnselect-request-update-info (group info &optional server)
-  (let ((group  (nnselect-possibly-change-group group server)))
+  (let ((group  (nnselect-possibly-change-group group server))
+       (gnus-newsgroup-selection (or gnus-newsgroup-selection
+       nnselect-artlist)))
     (gnus-info-set-marks info nil)
     (gnus-info-set-read info nil)
     (pcase-dolist (`(,artgroup ,nartids)
                   (ids-by-group
-                   (number-sequence
-                    1 (nnselect-artlist-length nnselect-artlist))))
+                   (number-sequence 1 (nnselect-artlist-length
+                                       gnus-newsgroup-selection))))
       (let* ((gnus-newsgroup-active nil)
             (artids (cl-sort nartids '< :key 'car))
             (group-info (gnus-get-info artgroup))
@@ -463,12 +467,16 @@ If this variable is nil, or if the provided function returns nil,
                   (mapcar
                    #'(lambda (art)
                        (when (member (cdr art) range)
-                         (car art)))  artids))))))))
-  (gnus-set-active group (cons 1 (nnselect-artlist-length nnselect-artlist))))
+                         (car art)))  artids)))))))
+    (gnus-set-active group (cons 1 (nnselect-artlist-length
+                                   gnus-newsgroup-selection)))))
 
 (declare-function nnir-run-query "nnir" (specs))
 (deffoo nnselect-request-thread (header &optional group server)
   (let ((group (nnselect-possibly-change-group group server))
+       ;; find the best group for the originating article. if its a
+       ;; psuedo-article look for real articles in the same thread
+       ;; and see where they come from.
        (artgroup (nnselect-article-group
                   (if (> (mail-header-number header) 0)
                       (mail-header-number header)