From: morioka Date: Tue, 17 Feb 1998 12:48:20 +0000 (+0000) Subject: (eword-decode-structured-field-body): If `START-COLUMN' is nil, it X-Git-Tag: semi-0_118_2~7 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3169aeb54d5599ca8f3b9fb5bfee7e7bf5a6e5af;p=elisp%2Fsemi.git (eword-decode-structured-field-body): If `START-COLUMN' is nil, it uses `mapconcat'. --- diff --git a/eword-decode.el b/eword-decode.el index 91195d3..f984684 100644 --- a/eword-decode.el +++ b/eword-decode.el @@ -10,7 +10,7 @@ ;; Renamed: 1993/06/03 to tiny-mime.el ;; Renamed: 1995/10/03 from tiny-mime.el (split off encoder) ;; Renamed: 1997/02/22 from tm-ew-d.el -;; Version: $Revision: 1.5 $ +;; Version: $Revision: 1.6 $ ;; Keywords: encoded-word, MIME, multilingual, header, mail, news ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces). @@ -45,7 +45,7 @@ ;;; (defconst eword-decode-RCS-ID - "$Id: eword-decode.el,v 1.5 1998-02-17 12:29:22 morioka Exp $") + "$Id: eword-decode.el,v 1.6 1998-02-17 12:48:20 morioka Exp $") (defconst eword-decode-version (get-version-string eword-decode-RCS-ID)) @@ -479,32 +479,39 @@ decode the charset included in it, it is not decoded. 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)." - (or max-column - (setq max-column fill-column)) - (let ((c (or start-column 6)) - (tokens (eword-lexical-analyze string must-unfold)) - (result "")) - (while tokens - (let* ((token (car tokens)) - (type (car token))) - (setq tokens (cdr tokens)) - (if (eq type 'spaces) - (let* ((next-token (car tokens)) - (next-str (eword-decode-token next-token)) - (next-len (string-width next-str)) - (next-c (+ c next-len 1))) - (if (< next-c max-column) - (setq result (concat result " " next-str) - c next-c) - (setq result (concat result "\n " next-str) - c (1+ next-len))) - (setq tokens (cdr tokens)) - ) - (let* ((str (eword-decode-token token))) - (setq result (concat result str) - c (+ c (string-width str))) - )))) - result)) + (if start-column + ;; fold with max-column + (let ((c start-column) + (tokens (eword-lexical-analyze string must-unfold)) + (result "")) + (or max-column + (setq max-column fill-column)) + (while tokens + (let* ((token (car tokens)) + (type (car token))) + (setq tokens (cdr tokens)) + (if (eq type 'spaces) + (let* ((next-token (car tokens)) + (next-str (eword-decode-token next-token)) + (next-len (string-width next-str)) + (next-c (+ c next-len 1))) + (if (< next-c max-column) + (setq result (concat result " " next-str) + c next-c) + (setq result (concat result "\n " next-str) + c (1+ next-len))) + (setq tokens (cdr tokens)) + ) + (let* ((str (eword-decode-token token))) + (setq result (concat result str) + c (+ c (string-width str))) + )))) + result) + ;; Don't fold + (mapconcat (function eword-decode-token) + (eword-lexical-analyze string must-unfold) + "") + )) (defun eword-decode-unstructured-field-body (string &optional must-unfold) "Decode non us-ascii characters in STRING as unstructured field body.