-(defun quoted-printable-internal-encode-string (string)
- "Encode STRING to quoted-printable, and return the result."
- (with-temp-buffer
- (insert string)
- (quoted-printable-internal-encode-region (point-min)(point-max))
- (buffer-string)
+
+(defvar quoted-printable-internal-encoding-limit
+ (if (and (featurep 'xemacs)(featurep 'mule))
+ 0
+ (require 'path-util)
+ (if (exec-installed-p "mmencode")
+ 1000
+ (message "Don't found external encoder for Quoted-Printable!")
+ nil))
+ "*limit size to use internal quoted-printable encoder.
+If size of input to encode is larger than this limit,
+external encoder is called.")
+
+(defun quoted-printable-encode-region (start end)
+ "Encode current region by quoted-printable.
+START and END are buffer positions.
+This function calls internal quoted-printable encoder if size of
+region is smaller than `quoted-printable-internal-encoding-limit',
+otherwise it calls external quoted-printable encoder specified by
+`quoted-printable-external-encoder'. In this case, you must install
+the program (maybe mmencode included in metamail or XEmacs package)."
+ (interactive "r")
+ (if (and quoted-printable-internal-encoding-limit
+ (> (- end start) quoted-printable-internal-encoding-limit))
+ (quoted-printable-external-encode-region start end)
+ (quoted-printable-internal-encode-region start end)