Function: mml-parse-singlepart-with-multiple-charsets
mml-parse-singlepart-with-multiple-charsets is a byte-compiled
function defined in mml.el.gz.
Signature
(mml-parse-singlepart-with-multiple-charsets ORIG-TAG BEG END &optional USE-ASCII)
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/mml.el.gz
(defun mml-parse-singlepart-with-multiple-charsets
(orig-tag beg end &optional use-ascii)
(save-excursion
(save-restriction
(narrow-to-region beg end)
(goto-char (point-min))
(let ((current (or (mm-mime-charset (mm-charset-after))
(and use-ascii 'us-ascii)))
charset struct space newline paragraph)
(while (not (eobp))
(setq charset (mm-mime-charset (mm-charset-after)))
(cond
;; The charset remains the same.
((eq charset 'us-ascii))
((or (and use-ascii (not charset))
(eq charset current))
(setq space nil
newline nil
paragraph nil))
;; The initial charset was ascii.
((eq current 'us-ascii)
(setq current charset
space nil
newline nil
paragraph nil))
;; We have a change in charsets.
(t
(push (append
orig-tag
(list (cons 'contents
(buffer-substring-no-properties
beg (or paragraph newline space (point))))))
struct)
(setq beg (or paragraph newline space (point))
current charset
space nil
newline nil
paragraph nil)))
;; Compute places where it might be nice to break the part.
(cond
((memq (following-char) '(? ?\t))
(setq space (1+ (point))))
((and (eq (following-char) ?\n)
(not (bobp))
(eq (char-after (1- (point))) ?\n))
(setq paragraph (point)))
((eq (following-char) ?\n)
(setq newline (1+ (point)))))
(forward-char 1))
;; Do the final part.
(unless (= beg (point))
(push (append orig-tag
(list (cons 'contents
(buffer-substring-no-properties
beg (point)))))
struct))
struct))))