Importing Pterodactyl Gnus v0.95.
[elisp/gnus.git-] / lisp / mm-util.el
index 774e3b0..a8e8f8b 100644 (file)
     (x-ctext . ctext))
   "A mapping from invalid charset names to the real charset names.")
 
+(defconst mm-auto-save-coding-system
+  (cond 
+   ((memq 'emacs-mule (mm-get-coding-system-list))
+    (if (memq system-type '(windows-nt ms-dos ms-windows))
+       'emacs-mule-dos 'emacs-mule))
+   ((memq 'escape-quoted (mm-get-coding-system-list))
+    'escape-quoted)
+   ((memq 'no-conversion (mm-get-coding-system-list))
+    'no-conversion)
+   (t nil))
+  "Coding system of auto save file.")
+
 ;;; Internal variables:
 
 ;;; Functions:
@@ -174,6 +186,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)
+             (boundp 'enable-multibyte-characters)
             (default-value 'enable-multibyte-characters))
     (set-buffer-multibyte t)))
 
@@ -182,18 +195,22 @@ used as the line break code type of the coding system."
   (when (fboundp 'set-buffer-multibyte)
     (set-buffer-multibyte nil)))
 
+(defun mm-preferred-coding-system (charset)
+  ;; A typo in some Emacs versions.
+  (or (get-charset-property charset 'prefered-coding-system)
+      (get-charset-property charset 'preffered-coding-system)))
+
 (defun mm-mime-charset (charset)
   "Return the MIME charset corresponding to the MULE CHARSET."
   (if (fboundp 'coding-system-get)
       ;; This exists in Emacs 20.
       (or
-       (and (get-charset-property charset 'prefered-coding-system)
+       (and (mm-preferred-coding-system charset)
            (coding-system-get
-            (get-charset-property charset 'prefered-coding-system)
-            'mime-charset))
+            (mm-preferred-coding-system charset) 'mime-charset))
        (and (eq charset 'ascii)
            'us-ascii)
-       (get-charset-property charset 'prefered-coding-system)
+       (mm-preferred-coding-system charset)
        (mm-mule-charset-to-mime-charset charset))
     ;; This is for XEmacs.
     (mm-mule-charset-to-mime-charset charset)))