# HG changeset patch # User Richard M. Stallman # Date 899844456 0 # Node ID 0df26ec111fdf9ac0bf315dee44f36614a0c9a1a # Parent 5fc9fd384c5c99baaca8ecdef533958a77d31c3c (rmail-dont-reply-to): Understand about doublequotes; don't be fooled by commas inside them. diff -r 5fc9fd384c5c -r 0df26ec111fd lisp/mail/mail-utils.el --- a/lisp/mail/mail-utils.el Tue Jul 07 19:27:40 1998 +0000 +++ b/lisp/mail/mail-utils.el Tue Jul 07 20:47:36 1998 +0000 @@ -184,22 +184,40 @@ "") (concat (regexp-quote (user-login-name)) "\\>")))) - (let ((match (concat "\\(^\\|,\\)[ \t\n]*\\([^,\n]*[!<]\\|\\)\\(" - rmail-dont-reply-to-names - "\\|[^\,.<]*<\\(" rmail-dont-reply-to-names "\\)" + (let ((match (concat "\\(^\\|,\\)[ \t\n]*" + ;; Can anyone figure out what this is for? + ;; Is it an obsolete remnant of another way of + ;; handling Foo Bar ? + "\\([^,\n]*[!<]\\|\\)" + "\\(" + rmail-dont-reply-to-names + "\\|" + ;; Include the human name that precedes . + "\\([^\,.<\"]\\|\"[^\"]*\"\\)*" + "<\\(" rmail-dont-reply-to-names "\\)" "\\)")) (case-fold-search t) pos epos) - (while (setq pos (string-match match userids)) + (while (setq pos (string-match match userids pos)) (if (> pos 0) (setq pos (match-beginning 2))) (setq epos ;; Delete thru the next comma, plus whitespace after. (if (string-match ",[ \t\n]*" userids (match-end 0)) (match-end 0) (length userids))) - (setq userids - (mail-string-delete - userids pos epos))) + ;; Count the double-quotes since the beginning of the list. + ;; Reject this match if it is inside a pair of doublequotes. + (let (quote-pos inside-quotes) + (while (and (setq quote-pos (string-match "\"" userids quote-pos)) + (< quote-pos pos)) + (setq quote-pos (1+ quote-pos)) + (setq inside-quotes (not inside-quotes))) + (if inside-quotes + ;; Advance to next even-parity quote, and scan from there. + (setq pos (string-match "\"" userids pos)) + (setq userids + (mail-string-delete + userids pos epos))))) ;; get rid of any trailing commas (if (setq pos (string-match "[ ,\t\n]*\\'" userids)) (setq userids (substring userids 0 pos)))