Mercurial > emacs
comparison lisp/mail/mail-utils.el @ 27460:cccffb3304b3
(rmail-dont-reply-to): Replace matched
userids differently.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 27 Jan 2000 16:51:46 +0000 |
parents | 0d9fd0e4f7a3 |
children | fe108abb04e5 |
comparison
equal
deleted
inserted
replaced
27459:5500690f08f4 | 27460:cccffb3304b3 |
---|---|
224 rmail-dont-reply-to-names | 224 rmail-dont-reply-to-names |
225 "\\|" | 225 "\\|" |
226 ;; Include the human name that precedes <foo@bar>. | 226 ;; Include the human name that precedes <foo@bar>. |
227 "\\([^\,.<\"]\\|\"[^\"]*\"\\)*" | 227 "\\([^\,.<\"]\\|\"[^\"]*\"\\)*" |
228 "<\\(" rmail-dont-reply-to-names "\\)" | 228 "<\\(" rmail-dont-reply-to-names "\\)" |
229 "\\)")) | 229 "\\)[^,]*")) |
230 (case-fold-search t) | 230 (case-fold-search t) |
231 pos epos) | 231 pos epos) |
232 (while (setq pos (string-match match userids pos)) | 232 (while (setq pos (string-match match userids pos)) |
233 (if (> pos 0) (setq pos (match-beginning 2))) | 233 ;; If there's a match, it starts at the beginning of the string, |
234 (setq epos | 234 ;; or with `,'. We must delete from that position to the |
235 ;; Delete thru the next comma, plus whitespace after. | 235 ;; end of the user-id which starts at match-beginning 2. |
236 (if (string-match ",[ \t\n]*" userids (match-end 0)) | 236 (let (inside-quotes quote-pos) |
237 (match-end 0) | 237 (save-match-data |
238 (length userids))) | 238 (while (and (setq quote-pos (string-match "\"" userids quote-pos)) |
239 ;; Count the double-quotes since the beginning of the list. | 239 (< quote-pos pos)) |
240 ;; Reject this match if it is inside a pair of doublequotes. | 240 (setq quote-pos (1+ quote-pos)) |
241 (let (quote-pos inside-quotes) | 241 (setq inside-quotes (not inside-quotes)))) |
242 (while (and (setq quote-pos (string-match "\"" userids quote-pos)) | |
243 (< quote-pos pos)) | |
244 (setq quote-pos (1+ quote-pos)) | |
245 (setq inside-quotes (not inside-quotes))) | |
246 (if inside-quotes | 242 (if inside-quotes |
247 ;; Advance to next even-parity quote, and scan from there. | 243 ;; Advance to next even-parity quote, and scan from there. |
248 (setq pos (string-match "\"" userids pos)) | 244 (setq pos (string-match "\"" userids pos)) |
249 (setq userids | 245 (setq userids (replace-match "" nil nil userids))))) |
250 (mail-string-delete | |
251 userids pos epos))))) | |
252 ;; get rid of any trailing commas | 246 ;; get rid of any trailing commas |
253 (if (setq pos (string-match "[ ,\t\n]*\\'" userids)) | 247 (if (setq pos (string-match "[ ,\t\n]*\\'" userids)) |
254 (setq userids (substring userids 0 pos))) | 248 (setq userids (substring userids 0 pos))) |
255 ;; remove leading spaces. they bother me. | 249 ;; remove leading spaces. they bother me. |
256 (if (string-match "\\s *" userids) | 250 (if (string-match "\\s *" userids) |
257 (substring userids (match-end 0)) | 251 (substring userids (match-end 0)) |
258 userids))) | 252 userids))) |
253 | |
259 | 254 |
260 ;;;###autoload | 255 ;;;###autoload |
261 (defun mail-fetch-field (field-name &optional last all list) | 256 (defun mail-fetch-field (field-name &optional last all list) |
262 "Return the value of the header field whose type is FIELD-NAME. | 257 "Return the value of the header field whose type is FIELD-NAME. |
263 The buffer is expected to be narrowed to just the header of the message. | 258 The buffer is expected to be narrowed to just the header of the message. |