Function: undigestify-rmail-message
undigestify-rmail-message is an autoloaded, interactive and
byte-compiled function defined in undigest.el.gz.
Signature
(undigestify-rmail-message)
Documentation
Break up a digest message into its constituent messages.
Leaves original message, deleted, before the undigestified messages.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mail/undigest.el.gz
;;;###autoload
(defun undigestify-rmail-message ()
"Break up a digest message into its constituent messages.
Leaves original message, deleted, before the undigestified messages."
(interactive)
(set-buffer rmail-buffer)
(let ((buff (current-buffer))
(current rmail-current-message)
(msgbeg (rmail-msgbeg rmail-current-message))
(msgend (rmail-msgend rmail-current-message)))
(if (rmail-buffers-swapped-p) (set-buffer rmail-view-buffer))
(widen)
(let ((error t)
(buffer-read-only nil))
(goto-char msgend)
(let ((msg-copy (buffer-substring-no-properties msgbeg msgend)))
(narrow-to-region (point) (point))
(insert "\n" msg-copy))
(goto-char (point-min))
(unwind-protect
(progn
(let ((fill-prefix "")
(case-fold-search t)
digest-name fun-list sep-list start end)
(setq digest-name (mail-strip-quoted-names
(save-restriction
(search-forward "\n\n" nil 'move)
(narrow-to-region (point-min) (point))
(or (mail-fetch-field "Reply-To")
(mail-fetch-field "To")
(mail-fetch-field "Apparently-To")
(mail-fetch-field "From")))))
(unless digest-name
(error "Message is not a digest--bad header"))
(setq fun-list rmail-digest-methods)
(while (and fun-list
(null (setq sep-list (funcall (car fun-list)))))
(setq fun-list (cdr fun-list)))
(unless sep-list
(error "Message is not a digest--no messages found"))
;; Split the digest into separate rmail messages.
(while sep-list
(setq start (caar sep-list)
end (cdar sep-list))
(delete-region start end)
(goto-char start)
(search-forward "\n\n" (caar (cdr sep-list)) 'move)
(save-restriction
(narrow-to-region end (point))
(goto-char (point-min))
(insert "\nFrom rmail@localhost " (current-time-string) "\n")
(save-excursion
(forward-line -1)
(rmail-add-mbox-headers))
(unless (mail-fetch-field "To")
(insert "To: " digest-name "\n")))
(set-marker start nil)
(set-marker end nil)
(setq sep-list (cdr sep-list))))
(setq error nil)
(message "Message successfully undigestified")
(set-buffer buff)
(rmail-swap-buffers-maybe)
(goto-char (point-max))
;; FIXME use rmail-count-new-messages.
(rmail-set-message-counters)
(set-buffer-modified-p t)
(rmail-show-message current)
(rmail-delete-forward)
(if (rmail-summary-exists)
(rmail-select-summary (rmail-update-summary))))
(when error
(delete-region (point-min) (point-max))
(set-buffer buff)
(rmail-show-message current))))))