+(defun mm-qp-or-base64 ()
+ (save-excursion
+ (save-restriction
+ (narrow-to-region (point-min) (min (+ (point-min) 1000) (point-max)))
+ (goto-char (point-min))
+ (let ((8bit 0))
+ (cond
+ ((not (featurep 'mule))
+ (while (re-search-forward "[^\x20-\x7f\r\n\t]" nil t)
+ (incf 8bit)))
+ (t
+ ;; Mule version
+ (while (not (eobp))
+ (skip-chars-forward "\x20-\x7f\r\n\t")
+ (unless (eobp)
+ (forward-char 1)
+ (incf 8bit)))))
+ (if (> (/ (* 8bit 1.0) (buffer-size)) 0.166)
+ 'base64
+ 'quoted-printable)))))
+