]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve compression of nnselect-artlist
authorAndrew G Cohen <cohen@andy.bu.edu>
Mon, 28 Oct 2019 01:37:15 +0000 (09:37 +0800)
committerAndrew G Cohen <cohen@andy.bu.edu>
Mon, 28 Oct 2019 01:37:15 +0000 (09:37 +0800)
* lisp/gnus/nnselect.el (nnselect-uncompress-artlist,
  nnselect-get-artlist): Make the compression a bit faster and put
  the vectorp test into the nnselect-uncompress-artlist uncompress
  function.

lisp/gnus/nnselect.el

index 5dbc9b21180b48909ee2f716d554a3849d3428ff..4a2775f362083a2bf4aa482e4c51f5b35fd6929f 100644 (file)
     selection))
 
 (defun nnselect-uncompress-artlist (artlist)
-  (let (selection)
-    (pcase-dolist (`(,artgroup (,artrsv . ,artseq)) artlist)
-      (dolist (art (reverse (gnus-uncompress-sequence artseq)))
-        (push (vector artgroup art artrsv) selection)))
-    (apply #'vector selection)))
+  (if (vectorp artlist)
+      artlist
+    (let (selection)
+      (pcase-dolist (`(,artgroup (,artrsv . ,artseq)) artlist)
+       (setq selection
+             (vconcat
+              (map 'vector
+                   #'(lambda (art)
+                       (vector artgroup art artrsv))
+                   (gnus-uncompress-sequence artseq)) selection)))
+      selection)))
 
 (defun nnselect-group-server (group)
   (gnus-group-server group))
@@ -211,9 +217,7 @@ as `(keyfunc member)' and the corresponding element is just
   `(when (gnus-nnselect-group-p ,group)
      (let ((artlist
            (gnus-group-get-parameter ,group 'nnselect-artlist t)))
-       (if (or (not artlist) (vectorp artlist))
-          artlist
-        (nnselect-uncompress-artlist artlist)))))
+       (nnselect-uncompress-artlist artlist))))
 
 
 ;;; User Customizable Variables: