Mercurial > emacs
changeset 22710:0df26ec111fd
(rmail-dont-reply-to): Understand
about doublequotes; don't be fooled by commas inside them.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 07 Jul 1998 20:47:36 +0000 |
parents | 5fc9fd384c5c |
children | ed021e36c5f9 |
files | lisp/mail/mail-utils.el |
diffstat | 1 files changed, 25 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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 <foo@machine>? + "\\([^,\n]*[!<]\\|\\)" + "\\(" + rmail-dont-reply-to-names + "\\|" + ;; Include the human name that precedes <foo@bar>. + "\\([^\,.<\"]\\|\"[^\"]*\"\\)*" + "<\\(" 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)))