diff options
| author | Richard M. Stallman <rms@gnu.org> | 1998-07-07 20:47:36 +0000 |
|---|---|---|
| committer | Richard M. Stallman <rms@gnu.org> | 1998-07-07 20:47:36 +0000 |
| commit | fa9b4b917b034e059583e3943a53552cb2485c72 (patch) | |
| tree | 535ec2684ff1034576c9f3ab90bf594813c1c347 | |
| parent | 405ff5eaab179ba3162f3506c0d5af0e0f6ff04f (diff) | |
| download | emacs-fa9b4b917b034e059583e3943a53552cb2485c72.tar.gz | |
(rmail-dont-reply-to): Understand
about doublequotes; don't be fooled by commas inside them.
| -rw-r--r-- | lisp/mail/mail-utils.el | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el index 849fb517c62..cc71c1a50b1 100644 --- a/lisp/mail/mail-utils.el +++ b/lisp/mail/mail-utils.el @@ -184,22 +184,40 @@ Usenet paths ending in an element that matches are removed also." "") (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))) |
