This commit was generated by cvs2svn to compensate for changes in r823,
[elisp/semi.git] / mime-text.el
index e18416b..0e705f7 100644 (file)
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1994,1995,1996,1997 Free Software Foundation, Inc.
 
 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version:
-;;     $Id: mime-text.el,v 0.19 1997-03-16 01:56:00 morioka Exp $
+;; Version: $Id: mime-text.el,v 0.24 1997-07-02 16:20:22 morioka Exp $
 ;; Keywords: text, MIME, multimedia, mail, news
 
 ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
@@ -45,26 +44,54 @@ raw-buffer.")
 ;;;
 
 (defvar mime-text-decoder-alist
-  '((mime/show-message-mode    . mime-text-decode-buffer)
+  '((mime-show-message-mode    . mime-text-decode-buffer)
     (mime-temp-message-mode    . mime-text-decode-buffer)
-    (t                         . mime-charset/maybe-decode-buffer)
-    ))
+    (t                         . mime-text-decode-buffer-maybe)
+    )
+  "Alist of major-mode vs. mime-text-decoder.
+Each element looks like (SYMBOL . FUNCTION).  SYMBOL is major-mode or
+t.  t means default.
+
+Specification of FUNCTION is described in DOC-string of variable
+`mime-text-decoder'.
+
+This value is overridden by buffer local variable `mime-text-decoder'
+if it is not nil.")
 
 (defun mime-text-decode-buffer (charset &optional encoding)
+  "Decode text of current buffer as CHARSET.
+It code-converts current buffer from network representation specified
+by MIME CHARSET to internal code.  CHARSET is symbol of MIME charset.
+See also variable `mime-charset-coding-system-alist'."
   (decode-mime-charset-region (point-min)(point-max)
                              (or charset default-mime-charset))
   )
 
-(defun mime-charset/maybe-decode-buffer (charset &optional encoding)
+(defun mime-text-decode-buffer-maybe (charset &optional encoding)
+  "Decode text of current buffer as CHARSET if ENCODING is actual encoding.
+It code-converts current buffer from network representation specified
+by MIME CHARSET to internal code if ENCODING is not nil, \"7bit\",
+\"8bit\" or \"binary\".  CHARSET is symbol of MIME charset.
+See also variable `mime-charset-coding-system-alist'."
   (or (member encoding '(nil "7bit" "8bit" "binary"))
       (mime-text-decode-buffer charset)
       ))
 
 (defun mime-decode-text-body (charset encoding)
+  "Decode current buffer as text body.
+It decodes MIME-encoding as ENCODING then code-converts as MIME
+CHARSET.  CHARSET is SYMBOL and ENCODING is nil or STRING.
+
+It calls text decoder for MIME charset specified by buffer local
+variable `mime-text-decoder' and variable `mime-text-decoder-alist'."
   (mime-decode-region (point-min) (point-max) encoding)
+  (goto-char (point-min))
+  (while (search-forward "\r\n" nil t)
+    (replace-match "\n")
+    )
   (let ((text-decoder
         (save-excursion
-          (set-buffer mime::preview/article-buffer)
+          (set-buffer mime-raw-buffer)
           (or mime-text-decoder
               (cdr (or (assq major-mode mime-text-decoder-alist)
                        (assq t mime-text-decoder-alist)))
@@ -97,7 +124,7 @@ raw-buffer.")
 ;;; @ content filters for mime-text
 ;;;
 
-(defun mime-preview/filter-for-text/plain (ctype params encoding)
+(defun mime-view-filter-for-text/plain (ctype params encoding)
   (mime-decode-text-body (cdr (assoc "charset" params)) encoding)
   (goto-char (point-max))
   (if (not (eq (char-after (1- (point))) ?\n))
@@ -116,7 +143,7 @@ raw-buffer.")
   (run-hooks 'mime-view-plain-text-preview-hook)
   )
 
-(defun mime-preview/filter-for-text/richtext (ctype params encoding)
+(defun mime-view-filter-for-text/richtext (ctype params encoding)
   (let* ((charset (cdr (assoc "charset" params)))
         (beg (point-min))
         )
@@ -125,7 +152,7 @@ raw-buffer.")
     (richtext-decode beg (point-max))
     ))
 
-(defun mime-preview/filter-for-text/enriched (ctype params encoding)
+(defun mime-view-filter-for-text/enriched (ctype params encoding)
   (let* ((charset (cdr (assoc "charset" params)))
         (beg (point-min))
         )