From 34417317114065707f088bca3c89a81c25ee7d2a Mon Sep 17 00:00:00 2001 From: tomo Date: Wed, 20 Dec 2000 06:33:05 +0000 Subject: [PATCH] (encoded-text-encode-string): Add optional argument `mode'; use `base64-encode-string' directly for "B"-encoding. --- mel.el | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/mel.el b/mel.el index 6306d2f..8c84ac5 100644 --- a/mel.el +++ b/mel.el @@ -122,8 +122,8 @@ mmencode included in metamail or XEmacs package)." (buffer-string)))) (or (bolp) (insert ?\n))) - (mel-define-method-function (encoded-text-encode-string string (nil "B")) - 'base64-encode-string) + ;; (mel-define-method-function (encoded-text-encode-string string (nil "B")) + ;; 'base64-encode-string) (mel-define-method encoded-text-decode-string (string (nil "B")) (if (string-match (eval-when-compile (concat "\\`" B-encoded-text-regexp "\\'")) @@ -202,8 +202,18 @@ the STRING by its value." string))) -(mel-define-service encoded-text-encode-string (string encoding) - "Encode STRING as encoded-text using ENCODING. ENCODING must be string.") +(mel-define-service encoded-text-encode-string) +(defun encoded-text-encode-string (string encoding &optional mode) + "Encode STRING as encoded-text using ENCODING. +ENCODING must be string. +Optional argument MODE allows `text', `comment', `phrase' or nil. +Default value is `phrase'." + (if (string= encoding "B") + (base64-encode-string string 'no-line-break) + (let ((f (mel-find-function 'encoded-text-encode-string encoding))) + (if f + (funcall f string mode) + string)))) (mel-define-service encoded-text-decode-string (string encoding) "Decode STRING as encoded-text using ENCODING. ENCODING must be string.") -- 1.7.10.4