* Sync up to flim-1_11_2 from flim-1_11_0.
[elisp/flim.git] / eword-decode.el
index 60ccaf4..67c02e6 100644 (file)
@@ -476,36 +476,36 @@ Each field name must be symbol."
   :group 'eword-decode
   :type '(repeat symbol))
 
-(defun eword-decode-field (field-name field-body &optional unfolded max-column)
-  "If FIELD-NAME is in `eword-decode-ignored-field-list',
-return FIELD-BODY itself.
+(defun eword-decode-field-body
+  (field-body field-name &optional unfolded max-column)
+  "Decode FIELD-BODY as FIELD-NAME, and return the result.
 
-If FIELD-NAME is in `eword-decode-structured-field-list',
-FIELD-BODY is interpreted as structured field,
-decode MIME encoded-words and return it.
+If UNFOLDED is non-nil, it is assumed that FIELD-BODY is
+already unfolded.
 
-Otherwise, FIELD-BODY is interpreted as unstructured field,
-decode MIME encoded-words and return it.
+If MAX-COLUMN is non-nil, the result is folded with MAX-COLUMN
+or `fill-column' if MAX-COLUMN is t.
+Otherwise, the result is unfolded.
 
-Anyway, non-encoded-word part is decoded with `default-mime-charset'.
+MIME encoded-word in FIELD-BODY is recognized according to
+`eword-decode-ignored-field-list',
+`eword-decode-structured-field-list' and FIELD-NAME.
 
-If FIELD-BODY is already unfolded, UNFOLDED should be non-nil.
-
-If MAX-COLUMN is nil, FIELD-BODY is unfolded.
-Otherwise, FIELD-BODY is folded with with MAX-COLUMN
-(or `fill-column' if MAX-COLUMN is not integer.)"
+Non MIME encoded-word part in FILED-BODY is decoded with
+`default-mime-charset'."
+  (if (symbolp field-name) (setq field-name (symbol-name field-name)))
   (let ((decoded
           (if unfolded
             (let ((ew-ignore-76bytes-limit t))
-              (ew-decode-field (symbol-name field-name)
-                               (ew-lf-crlf-to-crlf field-body)))
-            (ew-decode-field (symbol-name field-name)
-                             (ew-lf-crlf-to-crlf field-body)))))
+              (ew-decode-field
+               field-name (ew-lf-crlf-to-crlf field-body)))
+            (ew-decode-field
+             field-name (ew-lf-crlf-to-crlf field-body)))))
     (if max-column
         (setq decoded (ew-crlf-refold
                        decoded
                        (1+ (string-width field-name))
-                       (if (integerp max-column) max-column fill-column)))
+                       (if (eq max-column t) fill-column max-column)))
       (setq decoded (ew-crlf-unfold decoded)))
     (ew-crlf-to-lf decoded)))