* nnshimbun.el (nnshimbun-request-expire-articles): Fix inhibiting the
[elisp/gnus.git-] / lisp / mm-util.el
index c3d237a..1f124e7 100644 (file)
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+(eval-when-compile (require 'gnus-clfns))
 (eval-when-compile (require 'static))
 
-(eval-when-compile (require 'cl))
 (require 'mail-prsvr)
 
 (defvar mm-mime-mule-charset-alist
-  '((us-ascii ascii)
+  `((us-ascii ascii)
     (iso-8859-1 latin-iso8859-1)
     (iso-8859-2 latin-iso8859-2)
     (iso-8859-3 latin-iso8859-3)
                    chinese-cns11643-3 chinese-cns11643-4
                    chinese-cns11643-5 chinese-cns11643-6
                    chinese-cns11643-7)
-    (utf-8 unicode-a unicode-b unicode-c unicode-d unicode-e))
+    ,(if (or (not (fboundp 'charsetp)) ;; non-Mule case
+            (not (fboundp 'coding-system-p))
+            (charsetp 'unicode-a)
+            (not (coding-system-p 'mule-utf-8)))
+        '(utf-8 unicode-a unicode-b unicode-c unicode-d unicode-e)
+       ;; If we have utf-8 we're in Mule 5+.
+       (delete 'ascii (coding-system-get 'mule-utf-8 'safe-charsets))))
   "Alist of MIME-charset/MULE-charsets.")
 
 (eval-and-compile
              (setq idx (1+ idx)))
            string)))
      (string-as-unibyte . identity)
-      )))
+     (multibyte-string-p . ignore))))
 
 (eval-and-compile
   (defalias 'mm-char-or-char-int-p
@@ -301,13 +308,14 @@ If the charset is `composition', return the actual one."
                 (setq mail-parse-mule-charset
                       (or (car (last (assq mail-parse-charset
                                            mm-mime-mule-charset-alist)))
+                          ;; Fixme: don't fix that!
                           'latin-iso8859-1)))
             mail-parse-mule-charset)))))))
 
 (defun mm-mime-charset (charset)
   "Return the MIME charset corresponding to the MULE CHARSET."
   (if (eq charset 'unknown)
-      (error "8-bit characters are found in the message, please specify charset."))
+      (error "The message contains non-printable characters, please use attachment."))
   (if (and (fboundp 'coding-system-get) (fboundp 'get-charset-property))
       ;; This exists in Emacs 20.
       (or
@@ -340,7 +348,8 @@ If the charset is `composition', return the actual one."
     (setq charsets (mm-delete-duplicates charsets))
     (if (and (> (length charsets) 1)
             (fboundp 'find-coding-systems-region)
-            (memq 'utf-8 (find-coding-systems-region b e)))
+            (let ((cs (find-coding-systems-region b e)))
+              (or (memq 'utf-8 cs) (memq 'mule-utf-8 cs))))
        '(utf-8)
       charsets)))
 
@@ -468,7 +477,7 @@ Mule4 only."
     (nreverse out)))
 
 (defvar mm-inhibit-file-name-handlers
-  '(jka-compr-handler)
+  '(jka-compr-handler image-file-handler)
   "A list of handlers doing (un)compression (etc) thingies.")
 
 (defun mm-insert-file-contents (filename &optional visit beg end replace