aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2010-03-08 11:17:30 -0500
committerChong Yidong2010-03-08 11:17:30 -0500
commit4e7cafbe337f4ea438a2b00a9cfeb84e6d744842 (patch)
tree211663f5628ddf4c80a1022cc2ff6805bbd39304
parentf7e0618c1371ef9fd39e585716966b82190998c1 (diff)
downloademacs-4e7cafbe337f4ea438a2b00a9cfeb84e6d744842.tar.gz
emacs-4e7cafbe337f4ea438a2b00a9cfeb84e6d744842.zip
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).
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/mail/rfc822.el56
2 files changed, 36 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cc3683eaa78..04ba881c59e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12010-03-08 Chong Yidong <cyd@stupidchicken.com>
2
3 * mail/rfc822.el (rfc822-addresses): Use nested catches to ensure
4 that all errors are caught, and that the return value is always a
5 list (Bug#5692).
6
12010-03-08 Kenichi Handa <handa@m17n.org> 72010-03-08 Kenichi Handa <handa@m17n.org>
2 8
3 * language/misc-lang.el (windows-1256): New coding system. 9 * language/misc-lang.el (windows-1256): New coding system.
diff --git a/lisp/mail/rfc822.el b/lisp/mail/rfc822.el
index 3048d56674b..2bdf16eff96 100644
--- a/lisp/mail/rfc822.el
+++ b/lisp/mail/rfc822.el
@@ -290,32 +290,36 @@
290 (replace-match "\\1 " t)) 290 (replace-match "\\1 " t))
291 291
292 (goto-char (point-min)) 292 (goto-char (point-min))
293 (let ((list ()) 293 ;; Give `rfc822-address-start' a non-nil initial value to
294 tem 294 ;; prevent `rfc822-bad-address' from raising a
295 ;; This is for rfc822-bad-address. Give it a non-nil 295 ;; `wrong-type-argument' error.
296 ;; initial value to prevent rfc822-bad-address from 296 (let* ((rfc822-address-start (point))
297 ;; raising a wrong-type-argument error 297 list tem
298 (rfc822-address-start (point))) 298 (err
299 (rfc822-nuke-whitespace) 299 (catch 'address
300 (while (not (eobp)) 300 ;; Note that `rfc822-nuke-whitespace' and
301 (setq rfc822-address-start (point)) 301 ;; `rfc822-looking-at' can throw.
302 (setq tem 302 (rfc822-nuke-whitespace)
303 (cond ((rfc822-looking-at ?\,) 303 (while (not (eobp))
304 nil) 304 (setq rfc822-address-start (point))
305 ((looking-at "[][\000-\037@;:\\.>)]") 305 (setq tem
306 (forward-char) 306 (cond ((rfc822-looking-at ?\,)
307 (catch 'address ; this is for rfc822-bad-address 307 nil)
308 (rfc822-bad-address 308 ((looking-at "[][\000-\037@;:\\.>)]")
309 (format "Strange character \\%c found" 309 (forward-char)
310 (preceding-char))))) 310 (catch 'address ; For rfc822-bad-address
311 (t 311 (rfc822-bad-address
312 (rfc822-addresses-1 t)))) 312 (format "Strange character \\%c found"
313 (cond ((null tem)) 313 (preceding-char)))))
314 ((stringp tem) 314 (t
315 (setq list (cons tem list))) 315 (rfc822-addresses-1 t))))
316 (t 316 (cond ((null tem))
317 (setq list (nconc (nreverse tem) list))))) 317 ((stringp tem)
318 (nreverse list))) 318 (setq list (cons tem list)))
319 (t
320 (setq list (nconc (nreverse tem) list)))))
321 nil)))
322 (nreverse (append (if err (list err)) list))))
319 (and buf (kill-buffer buf)))))) 323 (and buf (kill-buffer buf))))))
320 324
321(provide 'rfc822) 325(provide 'rfc822)