aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Abrahamsen2020-04-29 18:10:35 -0700
committerEric Abrahamsen2020-05-20 11:42:30 -0700
commit5b66483eadebbd3b1c37a46d2d987637b2872a8e (patch)
tree1a020b263f7e74a553e1554f8a9221b67c1c4d09
parentbd64571ef213a4279f897b7446e97ccd76fe4516 (diff)
downloademacs-5b66483eadebbd3b1c37a46d2d987637b2872a8e.tar.gz
emacs-5b66483eadebbd3b1c37a46d2d987637b2872a8e.zip
Prevent gnus-registry-handle-action from creating spurious entries
Thanks to Bob Newell for finding this. * lisp/gnus/gnus-registry.el (gnus-registry-handle-action): If a message entry ends up with no groups in its 'group key, that means the entry should be deleted.
-rw-r--r--lisp/gnus/gnus-registry.el36
1 files changed, 19 insertions, 17 deletions
diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index 480ed80ef81..f306889a7fc 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -485,23 +485,25 @@ This is not required after changing `gnus-registry-cache-file'."
485 (when from 485 (when from
486 (setq entry (cons (delete from (assoc 'group entry)) 486 (setq entry (cons (delete from (assoc 'group entry))
487 (assq-delete-all 'group entry)))) 487 (assq-delete-all 'group entry))))
488 488 ;; Only keep the entry if the message is going to a new group, or
489 (dolist (kv `((group ,to) 489 ;; it's still in some previous group.
490 (sender ,sender) 490 (when (or to (alist-get 'group entry))
491 (recipient ,@recipients) 491 (dolist (kv `((group ,to)
492 (subject ,subject))) 492 (sender ,sender)
493 (when (cadr kv) 493 (recipient ,@recipients)
494 (let ((new (or (assq (car kv) entry) 494 (subject ,subject)))
495 (list (car kv))))) 495 (when (cadr kv)
496 (dolist (toadd (cdr kv)) 496 (let ((new (or (assq (car kv) entry)
497 (unless (member toadd new) 497 (list (car kv)))))
498 (setq new (append new (list toadd))))) 498 (dolist (toadd (cdr kv))
499 (setq entry (cons new 499 (unless (member toadd new)
500 (assq-delete-all (car kv) entry)))))) 500 (setq new (append new (list toadd)))))
501 (gnus-message 10 "Gnus registry: new entry for %s is %S" 501 (setq entry (cons new
502 id 502 (assq-delete-all (car kv) entry))))))
503 entry) 503 (gnus-message 10 "Gnus registry: new entry for %s is %S"
504 (gnus-registry-insert db id entry))) 504 id
505 entry)
506 (gnus-registry-insert db id entry))))
505 507
506;; Function for nn{mail|imap}-split-fancy: look up all references in 508;; Function for nn{mail|imap}-split-fancy: look up all references in
507;; the cache and if a match is found, return that group. 509;; the cache and if a match is found, return that group.