aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-07-07 20:47:36 +0000
committerRichard M. Stallman1998-07-07 20:47:36 +0000
commitfa9b4b917b034e059583e3943a53552cb2485c72 (patch)
tree535ec2684ff1034576c9f3ab90bf594813c1c347
parent405ff5eaab179ba3162f3506c0d5af0e0f6ff04f (diff)
downloademacs-fa9b4b917b034e059583e3943a53552cb2485c72.tar.gz
emacs-fa9b4b917b034e059583e3943a53552cb2485c72.zip
(rmail-dont-reply-to): Understand
about doublequotes; don't be fooled by commas inside them.
-rw-r--r--lisp/mail/mail-utils.el32
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."
184 "") 184 "")
185 (concat (regexp-quote (user-login-name)) 185 (concat (regexp-quote (user-login-name))
186 "\\>")))) 186 "\\>"))))
187 (let ((match (concat "\\(^\\|,\\)[ \t\n]*\\([^,\n]*[!<]\\|\\)\\(" 187 (let ((match (concat "\\(^\\|,\\)[ \t\n]*"
188 rmail-dont-reply-to-names 188 ;; Can anyone figure out what this is for?
189 "\\|[^\,.<]*<\\(" rmail-dont-reply-to-names "\\)" 189 ;; Is it an obsolete remnant of another way of
190 ;; handling Foo Bar <foo@machine>?
191 "\\([^,\n]*[!<]\\|\\)"
192 "\\("
193 rmail-dont-reply-to-names
194 "\\|"
195 ;; Include the human name that precedes <foo@bar>.
196 "\\([^\,.<\"]\\|\"[^\"]*\"\\)*"
197 "<\\(" rmail-dont-reply-to-names "\\)"
190 "\\)")) 198 "\\)"))
191 (case-fold-search t) 199 (case-fold-search t)
192 pos epos) 200 pos epos)
193 (while (setq pos (string-match match userids)) 201 (while (setq pos (string-match match userids pos))
194 (if (> pos 0) (setq pos (match-beginning 2))) 202 (if (> pos 0) (setq pos (match-beginning 2)))
195 (setq epos 203 (setq epos
196 ;; Delete thru the next comma, plus whitespace after. 204 ;; Delete thru the next comma, plus whitespace after.
197 (if (string-match ",[ \t\n]*" userids (match-end 0)) 205 (if (string-match ",[ \t\n]*" userids (match-end 0))
198 (match-end 0) 206 (match-end 0)
199 (length userids))) 207 (length userids)))
200 (setq userids 208 ;; Count the double-quotes since the beginning of the list.
201 (mail-string-delete 209 ;; Reject this match if it is inside a pair of doublequotes.
202 userids pos epos))) 210 (let (quote-pos inside-quotes)
211 (while (and (setq quote-pos (string-match "\"" userids quote-pos))
212 (< quote-pos pos))
213 (setq quote-pos (1+ quote-pos))
214 (setq inside-quotes (not inside-quotes)))
215 (if inside-quotes
216 ;; Advance to next even-parity quote, and scan from there.
217 (setq pos (string-match "\"" userids pos))
218 (setq userids
219 (mail-string-delete
220 userids pos epos)))))
203 ;; get rid of any trailing commas 221 ;; get rid of any trailing commas
204 (if (setq pos (string-match "[ ,\t\n]*\\'" userids)) 222 (if (setq pos (string-match "[ ,\t\n]*\\'" userids))
205 (setq userids (substring userids 0 pos))) 223 (setq userids (substring userids 0 pos)))