- (setq frag-anchor (funcall (car tmp) (1+ (length field-name)) field-body))
- ;;(setq zzz frag-anchor)
- (when (and (eq (car tmp) 'ew-scan-unibyte-unstructured)
- ew-decode-sticked-encoded-word)
- (ew-separate-eword (get frag-anchor 'next-frag)
- frag-anchor
- '(ew:us-texts)))
- (when (cdr tmp)
- (ew-mark (cdr tmp) frag-anchor))
- (setq frag1 (get frag-anchor 'next-frag))
- (while (not (eq frag1 frag-anchor))
- (setq decode (get frag1 'decode))
- (setq frag2 (get frag1 'next-frag))
- (while (and (not (eq frag2 frag-anchor))
- (eq decode (get frag2 'decode)))
- (setq frag2 (get frag2 'next-frag)))
- (funcall decode frag-anchor frag1 frag2 eword-filter)
- (setq frag1 frag2))
- (setq frag1 (get frag-anchor 'prev-frag)
- tmp ())
- (while (not (eq frag1 frag-anchor))
- (setq tmp (cons (or (get frag1 'decoded) (symbol-name frag1)) tmp)
- frag1 (get frag1 'prev-frag)))
- (apply 'concat tmp)))
+ (setq anchor (funcall (car tmp) (1+ (length field-name)) field-body))
+ (put anchor 'field-name field-name)
+ (put anchor 'scanner (car tmp))
+ (put anchor 'marker (cdr tmp))
+ anchor))
+
+(defun ew-decode-analyzed-field (anchor)
+ "Decode analyzed field."
+ (or (get anchor 'decoded)
+ (let (tmp frag1 frag2 decode)
+ (when ew-decode-sticked-encoded-word
+ (ew-separate-eword
+ (get anchor 'next-frag)
+ anchor
+ (if (eq (get anchor 'scanner) 'ew-scan-unibyte-unstructured)
+ '(ew:us-texts)
+ '(ew:cm-texts))))
+ (when (get anchor 'marker)
+ (ew-mark (get anchor 'marker) anchor))
+ (setq frag1 (get anchor 'next-frag))
+ (while (not (eq frag1 anchor))
+ (setq decode (get frag1 'decode))
+ (setq frag2 (get frag1 'next-frag))
+ (while (and (not (eq frag2 anchor))
+ (eq decode (get frag2 'decode)))
+ (setq frag2 (get frag2 'next-frag)))
+ (funcall decode anchor frag1 frag2)
+ (setq frag1 frag2))
+ (setq frag1 (get anchor 'prev-frag)
+ tmp ())
+ (while (not (eq frag1 anchor))
+ (setq tmp (cons (or (get frag1 'decoded) (symbol-name frag1)) tmp)
+ frag1 (get frag1 'prev-frag)))
+ (put anchor 'decoded (apply 'concat tmp)))))
+
+(defun ew-decode-field-no-cache (field-name field-body)
+ "No caching version of ew-decode-field."
+ (ew-decode-analyzed-field
+ (ew-analyze-field-to-decode field-name field-body)))