emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r99632: Additional fix for rfc822-add


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99632: Additional fix for rfc822-addresses (Bug#5692).
Date: Mon, 08 Mar 2010 11:17:30 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99632
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Mon 2010-03-08 11:17:30 -0500
message:
  Additional fix for rfc822-addresses (Bug#5692).
  
  * mail/rfc822.el (rfc822-addresses): Use nested catches to ensure
  that all errors are caught, and that the return value is always a
  list (Bug#5692).
modified:
  lisp/ChangeLog
  lisp/mail/rfc822.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-03-08 13:00:18 +0000
+++ b/lisp/ChangeLog    2010-03-08 16:17:30 +0000
@@ -1,3 +1,9 @@
+2010-03-08  Chong Yidong  <address@hidden>
+
+       * mail/rfc822.el (rfc822-addresses): Use nested catches to ensure
+       that all errors are caught, and that the return value is always a
+       list (Bug#5692).
+
 2010-03-08  Kenichi Handa  <address@hidden>
 
        * language/misc-lang.el (windows-1256): New coding system.

=== modified file 'lisp/mail/rfc822.el'
--- a/lisp/mail/rfc822.el       2010-03-07 17:34:40 +0000
+++ b/lisp/mail/rfc822.el       2010-03-08 16:17:30 +0000
@@ -290,32 +290,36 @@
               (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]