* gnus-sum.el (gnus-read-move-group-name):
[gnus] / lisp / mm-util.el
index 1634ce3..998724a 100644 (file)
@@ -1,5 +1,5 @@
 ;;; mm-util.el --- Utility functions for MIME things
 ;;; mm-util.el --- Utility functions for MIME things
-;; Copyright (C) 1998,99 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2000 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
 
 ;;; Code:
 
 
 ;;; Code:
 
-(defvar mm-running-xemacs (string-match "XEmacs" emacs-version))
-
-(defvar mm-running-ntemacs
-  (and (not mm-running-xemacs)
-       (string-match "nt" system-configuration)))
-
-(defvar mm-binary-coding-system
-  (if mm-running-xemacs
-      'binary 'no-conversion)
-  "100% binary coding system.")
-
-(defvar mm-text-coding-system
-  (cond
-   ((not (fboundp 'coding-system-p)) nil)
-   (mm-running-xemacs  ;; XEmacs
-    'no-conversion)
-   (mm-running-ntemacs ;; NTEmacs
-    (and (coding-system-p 'raw-text-dos) 'raw-text-dos))
-   ((coding-system-p 'raw-text) 'raw-text) ;; Emacs
-   (t nil))
-  "100% text coding system, for removing ^M.")
+(require 'mail-prsvr)
 
 (defvar mm-mime-mule-charset-alist
   '((us-ascii ascii)
 
 (defvar mm-mime-mule-charset-alist
   '((us-ascii ascii)
@@ -59,9 +39,7 @@
     (iso-8859-8 hebrew-iso8859-8)
     (iso-8859-9 latin-iso8859-9)
     (viscii vietnamese-viscii-lower)
     (iso-8859-8 hebrew-iso8859-8)
     (iso-8859-9 latin-iso8859-9)
     (viscii vietnamese-viscii-lower)
-    (iso-2022-jp-2 japanese-jisx0208)
-    (iso-2022-jp latin-jisx0201
-                japanese-jisx0208-1978)
+    (iso-2022-jp latin-jisx0201 japanese-jisx0208 japanese-jisx0208-1978)
     (euc-kr korean-ksc5601)
     (cn-gb-2312 chinese-gb2312)
     (cn-big5 chinese-big5-1 chinese-big5-2)
     (euc-kr korean-ksc5601)
     (cn-gb-2312 chinese-gb2312)
     (cn-big5 chinese-big5-1 chinese-big5-2)
                    chinese-cns11643-1 chinese-cns11643-2
                    chinese-cns11643-3 chinese-cns11643-4
                    chinese-cns11643-5 chinese-cns11643-6
                    chinese-cns11643-1 chinese-cns11643-2
                    chinese-cns11643-3 chinese-cns11643-4
                    chinese-cns11643-5 chinese-cns11643-6
-                   chinese-cns11643-7))
+                   chinese-cns11643-7)
+    (utf-8 unicode-a unicode-b unicode-c unicode-d unicode-e))
   "Alist of MIME-charset/MULE-charsets.")
 
   "Alist of MIME-charset/MULE-charsets.")
 
-
 (eval-and-compile
   (mapcar
    (lambda (elem)
      (let ((nfunc (intern (format "mm-%s" (car elem)))))
        (if (fboundp (car elem))
 (eval-and-compile
   (mapcar
    (lambda (elem)
      (let ((nfunc (intern (format "mm-%s" (car elem)))))
        (if (fboundp (car elem))
-          (fset nfunc (car elem))
-        (fset nfunc (cdr elem)))))
+          (defalias nfunc (car elem))
+        (defalias nfunc (cdr elem)))))
    '((decode-coding-string . (lambda (s a) s))
      (encode-coding-string . (lambda (s a) s))
      (encode-coding-region . ignore)
    '((decode-coding-string . (lambda (s a) s))
      (encode-coding-string . (lambda (s a) s))
      (encode-coding-region . ignore)
           prompt (mapcar (lambda (s) (list (symbol-name (car s))))
                          mm-mime-mule-charset-alist)))))))
 
           prompt (mapcar (lambda (s) (list (symbol-name (car s))))
                          mm-mime-mule-charset-alist)))))))
 
+(eval-and-compile
+  (defalias 'mm-char-or-char-int-p
+    (cond 
+     ((fboundp 'char-or-char-int-p) 'char-or-char-int-p)
+     ((fboundp 'char-valid-p) 'char-valid-p) 
+     (t 'identity))))
+
 (defvar mm-coding-system-list nil)
 (defun mm-get-coding-system-list ()
   "Get the coding system list."
 (defvar mm-coding-system-list nil)
 (defun mm-get-coding-system-list ()
   "Get the coding system list."
 (defvar mm-charset-synonym-alist
   '((big5 . cn-big5)
     (gb2312 . cn-gb-2312)
 (defvar mm-charset-synonym-alist
   '((big5 . cn-big5)
     (gb2312 . cn-gb-2312)
-    (iso-2022-jp-2 . iso-2022-7bit-ss2)
     (x-ctext . ctext))
   "A mapping from invalid charset names to the real charset names.")
 
     (x-ctext . ctext))
   "A mapping from invalid charset names to the real charset names.")
 
+(defun mm-coding-system-p (sym)
+  "Return non-nil if SYM is a coding system."
+  (or (and (fboundp 'coding-system-p) (coding-system-p sym))
+      (memq sym (mm-get-coding-system-list))))
+
+(defvar mm-binary-coding-system
+  (cond 
+   ((mm-coding-system-p 'binary) 'binary)
+   ((mm-coding-system-p 'no-conversion) 'no-conversion)
+   (t nil))
+  "100% binary coding system.")
+
+(defvar mm-text-coding-system
+  (or (if (memq system-type '(windows-nt ms-dos ms-windows))
+         (and (mm-coding-system-p 'raw-text-dos) 'raw-text-dos)
+       (and (mm-coding-system-p 'raw-text) 'raw-text))
+      mm-binary-coding-system)
+  "Text-safe coding system (For removing ^M).")
+
+(defvar mm-text-coding-system-for-write nil
+  "Text coding system for write.")
+
+(defvar mm-auto-save-coding-system
+  (cond 
+   ((mm-coding-system-p 'emacs-mule)
+    (if (memq system-type '(windows-nt ms-dos ms-windows))
+       (if (mm-coding-system-p 'emacs-mule-dos) 
+           'emacs-mule-dos mm-binary-coding-system)
+      'emacs-mule))
+   ((mm-coding-system-p 'escape-quoted) 'escape-quoted)
+   (t mm-binary-coding-system))
+  "Coding system of auto save file.")
+
 ;;; Internal variables:
 
 ;;; Functions:
 ;;; Internal variables:
 
 ;;; Functions:
@@ -186,6 +203,7 @@ used as the line break code type of the coding system."
 (defsubst mm-enable-multibyte ()
   "Enable multibyte in the current buffer."
   (when (and (fboundp 'set-buffer-multibyte)
 (defsubst mm-enable-multibyte ()
   "Enable multibyte in the current buffer."
   (when (and (fboundp 'set-buffer-multibyte)
+          &nb