Function: mm-find-raw-part-by-type
mm-find-raw-part-by-type is a byte-compiled function defined in
mm-decode.el.gz.
Signature
(mm-find-raw-part-by-type CTL TYPE &optional NOTP)
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/mm-decode.el.gz
(defun mm-find-raw-part-by-type (ctl type &optional notp)
(goto-char (point-min))
(let* ((boundary (concat "--" (mm-handle-multipart-ctl-parameter ctl
'boundary)))
(close-delimiter (concat "^" (regexp-quote boundary) "--[ \t]*$"))
start
(end (save-excursion
(goto-char (point-max))
(if (re-search-backward close-delimiter nil t)
(match-beginning 0)
(point-max))))
result)
(setq boundary (concat "^" (regexp-quote boundary) "[ \t]*$"))
(while (and (not result)
(re-search-forward boundary end t))
(goto-char (match-beginning 0))
(when start
(save-excursion
(save-restriction
(narrow-to-region start (1- (point)))
(when (let* ((ct (mail-fetch-field "content-type"))
(ctl (and ct (mail-header-parse-content-type ct))))
(if notp
(not (equal (car ctl) type))
(equal (car ctl) type)))
(setq result (buffer-string))))))
(forward-line 1)
(setq start (point)))
(when (and (not result) start)
(save-excursion
(save-restriction
(narrow-to-region start end)
(when (let* ((ct (mail-fetch-field "content-type"))
(ctl (and ct (mail-header-parse-content-type ct))))
(if notp
(not (equal (car ctl) type))
(equal (car ctl) type)))
(setq result (buffer-string))))))
result))