+2004-12-03  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * gnus-sum.el (gnus-summary-limit-to-recipient): Implement
+       not-matching option.
+
 2004-12-02  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * gnus-sum.el (gnus-summary-limit-to-recipient): New function.
 
 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
   "Limit the summary buffer to articles with the given RECIPIENT.
 
+If NOT-MATCHING, exclude RECIPIENT.
+
 To and Cc headers are checked.  You need to include them in
 `nnmail-extra-headers'."
   ;; Unlike `rmail-summary-by-recipients', doesn't include From.
                              (if current-prefix-arg "Exclude" "Limit to")))
         current-prefix-arg))
   (when (not (equal "" recipient))
-    (prog1 (let* ((articles1
+    (prog1 (let* ((to
                   (if (memq 'To nnmail-extra-headers)
                       (gnus-summary-find-matching
                        (cons 'extra 'To) recipient 'all nil nil
                      1 "`To' isn't present in `nnmail-extra-headers'")
                     (sit-for 1)
                     nil))
-                 (articles2
+                 (cc
                   (if (memq 'Cc nnmail-extra-headers)
                       (gnus-summary-find-matching
                        (cons 'extra 'Cc) recipient 'all nil nil
                      1 "`Cc' isn't present in `nnmail-extra-headers'")
                     (sit-for 1)
                     nil))
-                 (articles (nconc articles1 articles2)))
+                 (articles
+                  (if not-matching
+                      ;; We need the numbers that are in both lists:
+                      (mapcar (lambda (a)
+                                (and (memq a to) a))
+                              cc)
+                    (nconc to cc))))
             (unless articles
               (error "Found no matches for \"%s\"" recipient))
             (gnus-summary-limit articles))