From: akr Date: Sat, 25 Apr 1998 01:01:58 +0000 (+0000) Subject: * eword-decode.el (eword-decode-entire-string): Delete argument X-Git-Tag: flam-1_1_0~4 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6da1782dc21485ea2d33c12db497ac8c64f0dff6;p=elisp%2Fflim.git * eword-decode.el (eword-decode-entire-string): Delete argument `default-charset'. Add argument `code-conversion'. (eword-decode-unstructured): Add argument `code-conversion'. (eword-decode-comment): Add argument `code-conversion'. (eword-decode-quoted-string): Add argument `code-conversion'. (eword-decode-string): Propagate `code-conversion' to `eword-decode-unstructured'. (eword-decode-region): Propagate `code-conversion' to `eword-decode-unstructured'. --- diff --git a/ChangeLog b/ChangeLog index c563477..a47aaf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +1998-04-25 Tanaka Akira + + * eword-decode.el (eword-decode-entire-string): Delete argument + `default-charset'. Add argument `code-conversion'. + (eword-decode-unstructured): Add argument `code-conversion'. + (eword-decode-comment): Add argument `code-conversion'. + (eword-decode-quoted-string): Add argument `code-conversion'. + (eword-decode-string): Propagate `code-conversion' to + `eword-decode-unstructured'. + (eword-decode-region): Propagate `code-conversion' to + `eword-decode-unstructured'. + 1998-04-23 Shuhei KOBAYASHI * eword-decode.el (eword-decode-ignored-field-list): Add diff --git a/eword-decode.el b/eword-decode.el index 65ae6b5..b84861c 100644 --- a/eword-decode.el +++ b/eword-decode.el @@ -178,14 +178,19 @@ If MUST-UNFOLD is non-nil, it unfolds and eliminates line-breaks even if there are in decoded encoded-words (generated by bad manner MUA such as a version of Net$cape)." (if eword-decode-sticked-encoded-word (setq after-regexp "")) - (let ((between-ewords-regexp - (if eword-decode-sticked-encoded-word - "\\(\n?[ \t]\\)*" - "\\(\n?[ \t]\\)+")) - (src string) ; sequence of octets. - (dst "")) ; sequence of characters. - (if (string-match - (concat "\\`\\(" eword-regexp "\\)" after-regexp) src) + (let* ((between-ewords-regexp + (if eword-decode-sticked-encoded-word + "\\(\n?[ \t]\\)*" + "\\(\n?[ \t]\\)+")) + (between-ewords-eword-after-regexp + (concat "\\`\\(" between-ewords-regexp "\\)" + "\\(" eword-regexp "\\)" + after-regexp)) + (eword-after-regexp + (concat "\\`\\(" eword-regexp "\\)" after-regexp)) + (src string) ; sequence of octets. + (dst "")) ; sequence of characters. + (if (string-match eword-after-regexp src) (let* (p (q (match-end 1)) (ew (substring src 0 q)) @@ -196,11 +201,7 @@ such as a version of Net$cape)." (progn (while (and - (string-match - (concat "\\`\\(" between-ewords-regexp "\\)" - "\\(" eword-regexp "\\)" - after-regexp) - src) + (string-match between-ewords-eword-after-regexp src) (progn (setq p (match-end 1) q (match-end 3) @@ -223,9 +224,13 @@ such as a version of Net$cape)." safe-regexp escape ; ?\\ or nil. delimiters ; list of chars. - default-charset - must-unfold) - (let ((dst "") + must-unfold + code-conversion) + (if (and code-conversion + (not (mime-charset-to-coding-system code-conversion))) + (setq code-conversion default-mime-charset)) + (let ((equal-safe-regexp (concat "\\`=?" safe-regexp)) + (dst "") (buf "") (src string) (ew-enable t)) @@ -239,7 +244,7 @@ such as a version of Net$cape)." (or decoded (memq ch delimiters))) (setq dst (concat dst (std11-wrap-as-quoted-pairs - (decode-mime-charset-string buf default-charset) + (decode-mime-charset-string buf code-conversion) delimiters)) buf "")) (cond @@ -261,7 +266,7 @@ such as a version of Net$cape)." (setq buf (concat buf (substring src 0 (match-end 0))) src (substring src (match-end 0)) ew-enable t)) - ((and (string-match (concat "\\`=?" safe-regexp) src) + ((and (string-match equal-safe-regexp src) (< 0 (match-end 0))) (setq buf (concat buf (substring src 0 (match-end 0))) src (substring src (match-end 0)) @@ -270,7 +275,7 @@ such as a version of Net$cape)." (if (not (string= buf "")) (setq dst (concat dst (std11-wrap-as-quoted-pairs - (decode-mime-charset-string buf default-charset) + (decode-mime-charset-string buf code-conversion) delimiters)))) dst)) @@ -278,7 +283,7 @@ such as a version of Net$cape)." ;;; @ for string ;;; -(defun eword-decode-unstructured (string &optional must-unfold) +(defun eword-decode-unstructured (string &optional must-unfold code-conversion) (eword-decode-entire-string string eword-encoded-word-in-unstructured-regexp @@ -286,10 +291,10 @@ such as a version of Net$cape)." "[^ \t\n=]*" nil nil - default-mime-charset - must-unfold)) + must-unfold + code-conversion)) -(defun eword-decode-comment (string &optional must-unfold) +(defun eword-decode-comment (string &optional must-unfold code-conversion) (eword-decode-entire-string string eword-encoded-word-in-comment-regexp @@ -297,10 +302,10 @@ such as a version of Net$cape)." "[^ \t\n()\\\\=]*" ?\\ '(?\( ?\)) - default-mime-charset - must-unfold)) + must-unfold + code-conversion)) -(defun eword-decode-quoted-string (string &optional must-unfold) +(defun eword-decode-quoted-string (string &optional must-unfold code-conversion) (eword-decode-entire-string string eword-encoded-word-in-quoted-string-regexp @@ -308,10 +313,10 @@ such as a version of Net$cape)." "[^ \t\n\"\\\\=]*" ?\\ '(?\") - default-mime-charset - must-unfold)) + must-unfold + code-conversion)) -(defun eword-decode-string (string &optional must-unfold default-mime-charset) +(defun eword-decode-string (string &optional must-unfold code-conversion) "Decode MIME encoded-words in STRING. STRING is unfolded before decoding. @@ -324,14 +329,15 @@ if there are in decoded encoded-words (generated by bad manner MUA such as a version of Net$cape)." (eword-decode-unstructured (std11-unfold-string string) - must-unfold)) + must-unfold + code-conversion)) ;;; @ for region ;;; (defun eword-decode-region (start end &optional unfolding must-unfold - default-mime-charset) + code-conversion) "Decode MIME encoded-words in region between START and END. If UNFOLDING is not nil, it unfolds before decoding. @@ -348,7 +354,8 @@ such as a version of Net$cape)." ) (let ((str (eword-decode-unstructured (buffer-substring (point-min) (point-max)) - must-unfold))) + must-unfold + code-conversion))) (delete-region (point-min) (point-max)) (insert str))))) @@ -416,7 +423,7 @@ If SEPARATOR is not nil, it is used as header separator." code-conversion) (goto-char (point-max)) ))))) - (eword-decode-region (point-min) (point-max) t nil code-conversion) + (eword-decode-region (point-min) (point-max) t nil nil) )))) (defun eword-decode-unfold ()