From: akr Date: Sun, 25 Oct 1998 02:29:35 +0000 (+0000) Subject: * eword-decode.el (eword-decode-field-body): New function. X-Git-Tag: flim-1_11_2~25 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f34cdbd233928a5e6b8a715e33d20941cf5484ad;p=elisp%2Fflim.git * eword-decode.el (eword-decode-field-body): New function. (eword-decode-header): Use `eword-decode-field-body'. * mmgeneric.el (mime-insert-header-from-buffer): Use `eword-decode-field-body'. --- diff --git a/ChangeLog b/ChangeLog index 8b88526..5f4648b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ -Sun Oct 25 01:37:34 GMT 1998 +1998-10-25 Tanaka Akira + + * eword-decode.el (eword-decode-field-body): New function. + (eword-decode-header): Use `eword-decode-field-body'. + + * mmgeneric.el (mime-insert-header-from-buffer): Use + `eword-decode-field-body'. + 1998-10-25 Tanaka Akira * eword-encode.el (eword-encode-field-body): New function. diff --git a/eword-decode.el b/eword-decode.el index 8688d08..e3f49e4 100644 --- a/eword-decode.el +++ b/eword-decode.el @@ -315,7 +315,7 @@ Anyway, non-encoded-word part is decoded with `default-mime-charset'." (when (eq max-column t) (setq max-column fill-column)) (let ((field-name-symbol (intern (capitalize field-name))) - (len (string-width field-name))) + (len (1+ (string-width field-name)))) (if (memq field-name-symbol eword-decode-ignored-field-list) ;; Don't decode (if max-column @@ -350,36 +350,17 @@ If SEPARATOR is not nil, it is used as header separator." code-conversion default-mime-charset)))) (if default-charset - (let (beg p end field-name len) + (let (beg p end field-name field-body) (goto-char (point-min)) (while (re-search-forward std11-field-head-regexp nil t) (setq beg (match-beginning 0) p (match-end 0) field-name (buffer-substring beg (1- p)) - len (string-width field-name) - field-name (intern (capitalize field-name)) + field-body (buffer-substring p end) end (std11-field-end)) - (cond ((memq field-name eword-decode-ignored-field-list) - ;; Don't decode - ) - ((memq field-name eword-decode-structured-field-list) - ;; Decode as structured field - (let ((body (buffer-substring p end)) - (default-mime-charset default-charset)) - (delete-region p end) - (insert (eword-decode-and-fold-structured-field - body (1+ len))) - )) - (t - ;; Decode as unstructured field - (save-restriction - (narrow-to-region beg (1+ end)) - (decode-mime-charset-region p end default-charset) - (goto-char p) - (if (re-search-forward eword-encoded-word-regexp - nil t) - (eword-decode-region beg (point-max) 'unfold)) - ))))) + (delete-region p end) + (insert (eword-decode-field-body + field-name field-body nil t)))) (eword-decode-region (point-min) (point-max) t) ))))) diff --git a/mmgeneric.el b/mmgeneric.el index 6d67b99..df62c4e 100644 --- a/mmgeneric.el +++ b/mmgeneric.el @@ -148,7 +148,7 @@ &optional invisible-fields visible-fields) (let ((the-buf (current-buffer)) - f-b p f-e field-name len field field-body) + f-b p f-e field-name field field-body) (save-excursion (set-buffer buffer) (save-restriction @@ -158,25 +158,14 @@ (setq f-b (match-beginning 0) p (match-end 0) field-name (buffer-substring f-b p) - len (string-width field-name) f-e (std11-field-end)) (when (mime-visible-field-p field-name visible-fields invisible-fields) - (setq field (intern - (capitalize (buffer-substring f-b (1- p)))) + (setq field (buffer-substring f-b (1- p)) field-body (buffer-substring p f-e)) (with-current-buffer the-buf (insert field-name) - (insert - (if (memq field eword-decode-ignored-field-list) - ;; Don't decode - field-body - (if (memq field eword-decode-structured-field-list) - ;; Decode as structured field - (eword-decode-and-fold-structured-field field-body len) - ;; Decode as unstructured field - (eword-decode-unstructured-field-body field-body len) - ))) + (insert (eword-decode-field-body field field-body nil t)) (insert "\n") )))))))