* ew-compat.el: New file.
authorakr <akr>
Fri, 25 Sep 1998 05:07:46 +0000 (05:07 +0000)
committerakr <akr>
Fri, 25 Sep 1998 05:07:46 +0000 (05:07 +0000)
* FLIM-ELS (flim-modules): Add `ew-compat'.

ChangeLog
DOODLE-TIPS
FLIM-ELS
ew-compat.el [new file with mode: 0644]

index b86ee37..881b533 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+1998-09-25  Tanaka Akira      <akr@jaist.ac.jp>
+
+       * ew-compat.el: New file.
+
+       * FLIM-ELS (flim-modules): Add `ew-compat'.
+
 1998-09-21  Tanaka Akira      <akr@jaist.ac.jp>
 
        * mel.el: Use `broken-p' to check facility.
index f817d19..19608f5 100644 (file)
@@ -5,35 +5,18 @@ Especialy ew-line.el, ew-scan-m.el, ew-scan-s.el and ew-scan-u.el that
 are require 'lex.
 (lex is scanner generator.)
 
-* Multiline field-bodies fetched from XOVER is already concatinated,
-you should set ew-ignore-76bytes-limit to true.
-Currentry Gnus use these variables to decode and "Subject" and "From",
-tell it here. Unless doing it, DOODLE does not decode atoms in phrase
-because DOODLE cannot decide whether an atom is in phrase or not without
-field name information.
+* Multiline field-bodies fetched from XOVER is already unfolded,
+so special care is needed for gnus-structured-field-decoder and
+gnus-unstructured-field-decoder.
 
-(setq gnus-structured-field-decoder
-   (lambda (string)
-     (if (fboundp 'ew-decode-field)
-         (let ((ew-ignore-76bytes-limit t))
-           (ew-cut-cr-lf
-             (ew-decode-field "From" (ew-lf-crlf-to-crlf string))))
-       (eword-decode-and-unfold-structured-field string))))
+(autoload 'ew-gnus-structured-field-decoder "ew-compat")
+(setq gnus-structured-field-decoder 'ew-gnus-structured-field-decoder)
 
-(setq gnus-unstructured-field-decoder
-   (lambda (string)
-     (if (fboundp 'ew-decode-field)
-         (let ((ew-ignore-76bytes-limit t))
-           (ew-cut-cr-lf
-             (ew-decode-field "Subject" (ew-lf-crlf-to-crlf string))))
-       (eword-decode-unstructured-field-body
-         (std11-unfold-string string) 'must-unfold))))
+(autoload 'ew-gnus-unstructured-field-decoder "ew-compat")
+(setq gnus-unstructured-field-decoder 'ew-gnus-unstructured-field-decoder)
 
 * Ignore warnings about args-eword-* when byte-compiling.
 
-* If you have a problem with ew-ccl-b or other CCL based coding-system,
-set ew-bq-use-mel to t.
-
 * If you want to modify load-path or other variables when
 byte-compiling without editing files, set EVALARGS environment variable.
 
index 3b4949c..8b7e8e2 100644 (file)
--- a/FLIM-ELS
+++ b/FLIM-ELS
@@ -26,6 +26,7 @@
                      ew-scan-n
                      ew-dec
                     eword-decode eword-encode
+                     ew-compat
                     mime mime-parse mmbuffer mmcooked
                     mailcap
                      ))
diff --git a/ew-compat.el b/ew-compat.el
new file mode 100644 (file)
index 0000000..be59e96
--- /dev/null
@@ -0,0 +1,25 @@
+(require 'ew-dec)
+(require 'eword-decode)
+
+(defun ew-gnus-structured-field-decoder (string)
+  (if (fboundp 'ew-decode-field)
+      (let ((ew-ignore-76bytes-limit t)
+           (ew-default-mime-charset default-mime-charset))
+       (condition-case nil
+           (ew-cut-cr-lf (ew-decode-field "From" (ew-lf-crlf-to-crlf string)))
+         (error
+          (message "gnus-structured-field-decoder error: %s" string)
+          (decode-mime-charset-string string 'x-ctext))))
+    (eword-decode-and-unfold-structured-field string)))
+
+(defun ew-gnus-unstructured-field-decoder (string)
+  (if (fboundp 'ew-decode-field)
+      (let ((ew-ignore-76bytes-limit t)
+           (ew-default-mime-charset default-mime-charset))
+       (condition-case nil
+           (ew-cut-cr-lf (ew-decode-field "Subject" (ew-lf-crlf-to-crlf string)))
+         (error
+          (message "gnus-unstructured-field-decoder error: %s" string)
+          (decode-mime-charset-string string 'x-ctext))))
+    (eword-decode-unstructured-field-body (std11-unfold-string string) 'must-unfold)))
+