]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve compression of article lists in gnus/nnselect
authorAndrew G Cohen <cohen@andy.bu.edu>
Fri, 4 Feb 2022 00:30:32 +0000 (08:30 +0800)
committerAndrew G Cohen <cohen@andy.bu.edu>
Fri, 4 Feb 2022 01:04:20 +0000 (09:04 +0800)
* lisp/gnus/nnselect.el (nnselect-compress-artlist): Allow compressed list.
nnselect-uncompress-artlist): Properly loop over rsv values.

lisp/gnus/nnselect.el

index 205456a57dfb2659bdb4aa25cf947f00c0e3aeac..85df0284ef1ca76ffccbd7bcf20b1787eb963ef4 100644 (file)
 ;;; Helper routines.
 (defun nnselect-compress-artlist (artlist)
   "Compress ARTLIST."
-  (let (selection)
-    (pcase-dolist (`(,artgroup . ,arts)
-                   (nnselect-categorize artlist #'nnselect-artitem-group))
-      (let (list)
-        (pcase-dolist (`(,rsv . ,articles)
-                       (nnselect-categorize
-                        arts #'nnselect-artitem-rsv #'nnselect-artitem-number))
-          (push (cons rsv (gnus-compress-sequence (sort articles #'<)))
-                list))
-        (push (cons artgroup list) selection)))
-    selection))
+  (if (consp artlist)
+      artlist
+    (let (selection)
+      (pcase-dolist (`(,artgroup . ,arts)
+                     (nnselect-categorize artlist #'nnselect-artitem-group))
+       (let (list)
+          (pcase-dolist (`(,rsv . ,articles)
+                        (nnselect-categorize
+                          arts #'nnselect-artitem-rsv #'nnselect-artitem-number))
+            (push (cons rsv (gnus-compress-sequence (sort articles #'<)))
+                  list))
+          (push (cons artgroup list) selection)))
+      selection)))
 
 (defun nnselect-uncompress-artlist (artlist)
   "Uncompress ARTLIST."
   (if (vectorp artlist)
       artlist
     (let (selection)
-      (pcase-dolist (`(,artgroup (,artrsv . ,artseq)) artlist)
-       (setq selection
-             (vconcat
-              (cl-map 'vector
-                       (lambda (art)
-                         (vector artgroup art artrsv))
-                   (gnus-uncompress-sequence artseq)) selection)))
+      (pcase-dolist (`(,artgroup . ,list) artlist)
+       (pcase-dolist (`(,artrsv . ,artseq) list)
+         (setq selection
+               (vconcat
+                (cl-map 'vector
+                        (lambda (art)
+                           (vector artgroup art artrsv))
+                        (gnus-uncompress-sequence artseq)) selection))))
       selection)))
 
 (make-obsolete 'nnselect-group-server 'gnus-group-server "28.1")