- "")
- (concat (regexp-quote (user-login-name))
- "\\>"))))
- (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 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)))
- ;; 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)))
- ;; remove leading spaces. they bother me.
- (if (string-match "\\s *" userids)
- (substring userids (match-end 0))
- userids)))
+ "")
+ (if (and user-mail-address
+ (not (equal user-mail-address user-login-name)))
+ (concat (regexp-quote user-mail-address) "\\|")
+ "")
+ (concat (regexp-quote user-login-name) "\\>"))))
+ ;; Split up DESTINATIONS and match each element separately.
+ (let ((start-pos 0) (cur-pos 0)
+ (case-fold-search t))
+ (while start-pos
+ (setq cur-pos (string-match "[,\"]" destinations cur-pos))
+ (if (and cur-pos (equal (match-string 0 destinations) "\""))
+ ;; Search for matching quote.
+ (let ((next-pos (string-match "\"" destinations (1+ cur-pos))))
+ (if next-pos
+ (setq cur-pos (1+ next-pos))
+ ;; If the open-quote has no close-quote,
+ ;; delete the open-quote to get something well-defined.
+ ;; This case is not valid, but it can happen if things
+ ;; are weird elsewhere.
+ (setq destinations (concat (substring destinations 0 cur-pos)
+ (substring destinations (1+ cur-pos))))
+ (setq cur-pos start-pos)))
+ (let* ((address (substring destinations start-pos cur-pos))
+ (naked-address (mail-strip-quoted-names address)))
+ (if (string-match rmail-dont-reply-to-names naked-address)
+ (setq destinations (concat (substring destinations 0 start-pos)
+ (and cur-pos (substring destinations
+ (1+ cur-pos))))
+ cur-pos start-pos)
+ (setq cur-pos (and cur-pos (1+ cur-pos))
+ start-pos cur-pos))))))
+ ;; get rid of any trailing commas
+ (let ((pos (string-match "[ ,\t\n]*\\'" destinations)))
+ (if pos
+ (setq destinations (substring destinations 0 pos))))
+ ;; remove leading spaces. they bother me.
+ (if (string-match "\\(\\s \\|,\\)*" destinations)
+ (substring destinations (match-end 0))
+ destinations))
+