Function: rmail-digest-rfc1153

rmail-digest-rfc1153 is a byte-compiled function defined in undigest.el.gz.

Signature

(rmail-digest-rfc1153 PROLOG-SEP MESSAGE-SEP TRAILER-SEP)

Source Code

;; Defined in /usr/src/emacs/lisp/mail/undigest.el.gz
(defun rmail-digest-rfc1153 (prolog-sep message-sep trailer-sep)
  (goto-char (point-min))
  (when (re-search-forward prolog-sep nil t)
    ;; Ok, prolog separator found
    (let ((start (make-marker))
	  (end (make-marker))
	  separator result)
      (move-marker start (match-beginning 0))
      (move-marker end (match-end 0))
      (setq result (list (cons (copy-marker start) (copy-marker end t))))
      (when (re-search-forward message-sep nil t)
	;; Ok, at least one message separator found
	(setq separator (match-string 0))
	(when (re-search-forward trailer-sep nil t)
	  ;; Wonderful, we found a trailer, too.  Now, go on splitting
	  ;; the digest into separate rmail messages
	  (goto-char (cdar result))
	  (while (search-forward separator nil t)
	    (move-marker start (match-beginning 0))
	    (move-marker end (match-end 0))
	    (cl-pushnew (cons (copy-marker start) (copy-marker end t))
                        result :test #'equal))
	  ;; Undo masking of separators inside digestified messages
	  (goto-char (point-min))
	  (while (search-forward
		  (string-replace "\n-" "\n " separator) nil t)
	    (replace-match separator))
	  ;; Return the list of marker pairs
	  (nreverse result))))))