all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Improve propagation of gnus/nnselect group info
@ 2022-03-16  4:07 Andrew Cohen
  2022-03-17 10:42 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cohen @ 2022-03-16  4:07 UTC (permalink / raw)
  To: emacs-devel


* lisp/gnus/nnselect.el (nnselect-push-info): Speed up pushing the
nnselect info back to the originating groups.
---
 lisp/gnus/nnselect.el | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/lisp/gnus/nnselect.el b/lisp/gnus/nnselect.el
index 586dec65af..5eb5a0654a 100644
--- a/lisp/gnus/nnselect.el
+++ b/lisp/gnus/nnselect.el
@@ -878,6 +878,9 @@ nnselect-push-info
              ;; When the backend can store marks we collect any
              ;; changes.  Unlike a normal group the mark lists only
              ;; include marks for articles we retrieved.
+              (when (and (gnus-check-backend-function
+                         'request-set-mark gnus-newsgroup-name)
+                        (not (gnus-article-unpropagatable-p type)))
                (let* ((old (range-list-intersection
                             artlist
                             (alist-get type (gnus-info-marks group-info))))
@@ -889,7 +892,7 @@ nnselect-push-info
                    ;; This shouldn't happen, but is a sanity check.
                    (setq del (range-intersection
                               (gnus-active artgroup) del))
-                   (push (list del 'del (list type)) delta-marks)))
+                   (push (list del 'del (list type)) delta-marks))))
 
              ;; Marked sets are of mark-type 'tuple, 'list, or
              ;; 'range. We merge the lists with what is already in
@@ -914,12 +917,15 @@ nnselect-push-info
                    (setq list (cdr all))))
                ;; now merge with the original list and sort just to
                ;; make sure
-               (setq list
-                     (sort (map-merge
-                            'alist list
-                            (alist-get type (gnus-info-marks group-info)))
-                           (lambda (elt1 elt2)
-                             (< (car elt1) (car elt2))))))
+               (setq
+                 list (sort
+                       (map-merge
+                       'alist list
+                        (delq nil
+                              (mapcar
+                               (lambda (x) (unless (memq (car x) artlist) x))
+                               (alist-get type (gnus-info-marks group-info)))))
+                       'car-less-than-car)))
               (t
                (setq list
                      (range-compress-list
@@ -963,9 +969,14 @@ nnselect-push-info
                (cdr (assoc artgroup select-reads)))
               (sort (cdr (assoc artgroup select-unreads)) #'<))))
            (gnus-get-unread-articles-in-group
-            group-info (gnus-active artgroup) t)
-           (gnus-group-update-group artgroup t t)))))))
-
+            group-info (gnus-active artgroup) t))
+            ;;     (gnus-group-update-group artgroup t t)))))))
+            (gnus-group-update-group
+             artgroup t
+             (equal group-info
+                   (setq group-info (copy-sequence (gnus-get-info artgroup))
+                         group-info
+                          (delq (gnus-info-params group-info) group-info)))))))))
 
 (declare-function gnus-registry-get-id-key "gnus-registry" (id key))
 
-- 
2.34.1.575.g55b058a8bb


-- 
Andrew Cohen




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Improve propagation of gnus/nnselect group info
  2022-03-16  4:07 [PATCH] Improve propagation of gnus/nnselect group info Andrew Cohen
@ 2022-03-17 10:42 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2022-03-17 10:42 UTC (permalink / raw)
  To: Andrew Cohen; +Cc: emacs-devel

Andrew Cohen <acohen@ust.hk> writes:

> * lisp/gnus/nnselect.el (nnselect-push-info): Speed up pushing the
> nnselect info back to the originating groups.

[...]

> +            group-info (gnus-active artgroup) t))
> +            ;;     (gnus-group-update-group artgroup t t)))))))

Perhaps remove this commented-out bit, but if I understand the patch
correctly, it makes sense to me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-17 10:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-16  4:07 [PATCH] Improve propagation of gnus/nnselect group info Andrew Cohen
2022-03-17 10:42 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.