Function: gnus-summary-limit-to-address

gnus-summary-limit-to-address is an interactive and byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-summary-limit-to-address ADDRESS &optional NOT-MATCHING)

Documentation

Limit the summary buffer to articles with the given ADDRESS.

If NOT-MATCHING, exclude ADDRESS.

To, Cc and From headers are checked. You need to include To and Cc in nnmail-extra-headers.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-summary-limit-to-address (address &optional not-matching)
  "Limit the summary buffer to articles with the given ADDRESS.

If NOT-MATCHING, exclude ADDRESS.

To, Cc and From headers are checked.  You need to include `To' and `Cc'
in `nnmail-extra-headers'."
  (interactive
   (list
    (read-string
     (format "%s address (regexp): "
	     (if current-prefix-arg "Exclude" "Limit to")))
    current-prefix-arg)
   gnus-summary-mode)
  (when (not (equal "" address))
    (prog1 (let* ((to
		   (if (memq 'To nnmail-extra-headers)
		       (gnus-summary-find-matching
			(cons 'extra 'To) address 'all nil nil
			not-matching)
		     (gnus-message
		      1 "`To' isn't present in `nnmail-extra-headers'")
		     (sit-for 1)
		     t))
		  (cc
		   (if (memq 'Cc nnmail-extra-headers)
		       (gnus-summary-find-matching
			(cons 'extra 'Cc) address 'all nil nil
			not-matching)
		     (gnus-message
		      1 "`Cc' isn't present in `nnmail-extra-headers'")
		     (sit-for 1)
		     t))
		  (from
		   (gnus-summary-find-matching "from" address
					       'all nil nil not-matching))
		  (articles
		   (if not-matching
		       ;; We need the numbers that are in all lists:
		       (if (eq cc t)
			   (if (eq to t)
			       from
			     (mapcar (lambda (a) (car (memq a from))) to))
			 (mapcar (lambda (a) (car (memq a from)))
                                 (if (eq to t)
                                     cc
				   (mapcar (lambda (a) (car (memq a to)))
					   cc))))
		     (nconc (if (eq to t) nil to)
			    (if (eq cc t) nil cc)
			    from))))
	     (unless (or articles not-matching)
	       (error "Found no matches for \"%s\"" address))
	     (gnus-summary-limit articles))
      (gnus-summary-position-point))))