comparison lisp/mail/undigest.el @ 49878:3e58b8375243

(unforward-rmail-message): Allow nested unforwarding, that is, preserve old Forwarded-From/Date headers.
author Francesco Potortì <pot@gnu.org>
date Thu, 20 Feb 2003 08:56:08 +0000
parents b020ca291f89
children 695cf19ef79e
comparison
equal deleted inserted replaced
49877:d0dc4f0ff393 49878:3e58b8375243
230 following the containing message." 230 following the containing message."
231 (interactive) 231 (interactive)
232 ;; If we are in a summary buffer, switch to the Rmail buffer. 232 ;; If we are in a summary buffer, switch to the Rmail buffer.
233 (unwind-protect 233 (unwind-protect
234 (with-current-buffer rmail-buffer 234 (with-current-buffer rmail-buffer
235 (narrow-to-region (rmail-msgbeg rmail-current-message)
236 (rmail-msgend rmail-current-message))
237 (goto-char (point-min)) 235 (goto-char (point-min))
236 (narrow-to-region (point)
237 (save-excursion (search-forward "\n\n") (point)))
238 (let ((buffer-read-only nil) 238 (let ((buffer-read-only nil)
239 (forwarded-from (mail-fetch-field "From")) 239 (old-fwd-from (mail-fetch-field "Forwarded-From" nil nil t))
240 (forwarded-date (mail-fetch-field "Date")) 240 (old-fwd-date (mail-fetch-field "Forwarded-Date" nil nil t))
241 (fwd-from (mail-fetch-field "From"))
242 (fwd-date (mail-fetch-field "Date"))
241 beg end prefix forward-msg) 243 beg end prefix forward-msg)
244 (narrow-to-region (rmail-msgbeg rmail-current-message)
245 (rmail-msgend rmail-current-message))
246 (goto-char (point-min))
242 (cond ((re-search-forward rmail-forward-separator-regex nil t) 247 (cond ((re-search-forward rmail-forward-separator-regex nil t)
243 (forward-line 1) 248 (forward-line 1)
244 (skip-chars-forward "\n") 249 (skip-chars-forward "\n")
245 (setq beg (point)) 250 (setq beg (point))
246 (setq end (if (re-search-forward "^----.*[^- \t\n]" nil t) 251 (setq end (if (re-search-forward "^----.*[^- \t\n]" nil t)
272 (widen) 277 (widen)
273 (goto-char (rmail-msgend rmail-current-message)) 278 (goto-char (rmail-msgend rmail-current-message))
274 (narrow-to-region (point) (point)) 279 (narrow-to-region (point) (point))
275 (insert rmail-mail-separator) 280 (insert rmail-mail-separator)
276 (narrow-to-region (point) (point)) 281 (narrow-to-region (point) (point))
277 (insert "Forwarded-From: " forwarded-from "\n") 282 (while old-fwd-from
278 (insert "Forwarded-Date: " forwarded-date "\n") 283 (insert "Forwarded-From: " (car old-fwd-from) "\n")
284 (insert "Forwarded-Date: " (car old-fwd-date) "\n")
285 (setq old-fwd-from (cdr old-fwd-from))
286 (setq old-fwd-date (cdr old-fwd-date)))
287 (insert "Forwarded-From: " fwd-from "\n")
288 (insert "Forwarded-Date: " fwd-date "\n")
279 (insert forward-msg) 289 (insert forward-msg)
280 (save-restriction 290 (save-restriction
281 (goto-char (point-min)) 291 (goto-char (point-min))
282 (re-search-forward "\n$" nil 'move) 292 (re-search-forward "\n$" nil 'move)
283 (narrow-to-region (point-min) (point)) 293 (narrow-to-region (point-min) (point))