]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/rfc822.el
Update copyright year to 2015
[gnu-emacs] / lisp / mail / rfc822.el
index 3048d56674bad0bd7b0db71f4bd7f55a891ac91f..e127c4418aa4116c3df4c943882fb73512b545b5 100644 (file)
@@ -1,10 +1,10 @@
 ;;; rfc822.el --- hairy rfc822 parser for mail and news and suchlike
 
-;; Copyright (C) 1986, 1987, 1990, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1986-1987, 1990, 2001-2015 Free Software Foundation,
+;; Inc.
 
 ;; Author: Richard Mlynarik <mly@eddie.mit.edu>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
               (replace-match "\\1 " t))
 
             (goto-char (point-min))
-            (let ((list ())
-                  tem
-                  ;; This is for rfc822-bad-address.  Give it a non-nil
-                  ;; initial value to prevent rfc822-bad-address from
-                  ;; raising a wrong-type-argument error
-                  (rfc822-address-start (point)))
-             (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 ; this is 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)))))
-             (nreverse list)))
+           ;; 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))))))
 
 (provide 'rfc822)
 
-;; arch-tag: 5d388a24-e173-40fb-9b8e-85269de44b37
 ;;; rfc822.el ends here