Function: rfc822-addresses
rfc822-addresses is an autoloaded and byte-compiled function defined
in rfc822.el.gz.
Signature
(rfc822-addresses HEADER-TEXT)
Source Code
;; Defined in /usr/src/emacs/lisp/mail/rfc822.el.gz
(defun rfc822-addresses (header-text)
(if (string-match "\\`[ \t]*\\([^][\000-\037 ()<>@,;:\\\".]+\\)[ \t]*\\'"
header-text)
;; Make very simple case moderately fast.
(list (substring header-text (match-beginning 1) (match-end 1)))
(let ((buf (generate-new-buffer " rfc822")))
(unwind-protect
(with-current-buffer buf
(setq-local case-fold-search nil) ;For speed(?)
(insert header-text)
;; unfold continuation lines
(goto-char (point-min))
(while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]"
nil t)
(replace-match "\\1 " t))
(goto-char (point-min))
;; Give `rfc822-address-start' a non-nil initial value to
;; prevent `rfc822-bad-address' from raising a
;; `wrong-type-argument' error.
(let* ((rfc822-address-start (point))
list tem
(err
(catch 'address
;; Note that `rfc822-nuke-whitespace' and
;; `rfc822-looking-at' can throw.
(rfc822-nuke-whitespace)
(while (not (eobp))
(setq rfc822-address-start (point))
(setq tem
(cond ((rfc822-looking-at ?\,)
nil)
((looking-at "[][\000-\037@;:\\.>)]")
(forward-char)
(catch 'address ; For rfc822-bad-address
(rfc822-bad-address
(format "Strange character \\%c found"
(preceding-char)))))
(t
(rfc822-addresses-1 t))))
(cond ((null tem))
((stringp tem)
(setq list (cons tem list)))
(t
(setq list (nconc (nreverse tem) list)))))
nil)))
(nreverse (append (if err (list err)) list))))
(and buf (kill-buffer buf))))))