Function: rmail-epa-decode
rmail-epa-decode is a byte-compiled function defined in rmail.el.gz.
Signature
(rmail-epa-decode BEG BACK-FROM-END)
Source Code
;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
;; Decode all base64-encoded mime sections from BEG to (Z - BACK-FROM-END),
;; so that we save the decoding permanently in the Rmail buffer
;; if we permanently save the decryption.
(defun rmail-epa-decode (beg back-from-end)
(save-excursion
(goto-char beg)
(while (re-search-forward "--------------[0-9a-zA-Z]+\n"
(- (point-max) back-from-end) t)
;; The ending delimiter is a start delimiter if another section follows.
;; Otherwise it is an end delimiter, with -- affixed.
(let ((delim (concat (substring (match-string 0) 0 -1) "\\(\\|--\\)\n")))
(when (looking-at "\
Content-Type: text/[a-z]+; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64\n")
(goto-char (match-end 0))
;; Sometimes the attachment's headers are followed by blank lines
(while (eolp)
(forward-line 1))
(let ((start (point))
(inhibit-read-only t))
(re-search-forward delim)
(forward-line -1)
;; Sometimes the attachment's contents are followed by blank lines
(while (save-excursion (forward-line -1) (eolp))
(forward-line -1))
(base64-decode-region start (point))
(forward-line 1)))))))