* gnus.el: Don't test for `mm-guess-mime-charset'.
authorJesper Harder <harder@ifa.au.dk>
Sat, 3 May 2003 16:47:19 +0000 (16:47 +0000)
committerJesper Harder <harder@ifa.au.dk>
Sat, 3 May 2003 16:47:19 +0000 (16:47 +0000)
* mm-util.el (mm-guess-mime-charset): Remove.  Not used any more.

* gnus.el (gnus-default-charset): Set default value to
`undecided'.

* gnus-art.el (article-decode-charset): Don't supply 4th arg to
mm-decode-body.

* mm-bodies.el (mm-decode-coding-region-safely): Remove.
(mm-decode-body): Don't use mm-decode-coding-region-safely.

lisp/ChangeLog
lisp/gnus-art.el
lisp/gnus.el
lisp/mm-bodies.el
lisp/mm-util.el

index 329a8a3..dd5833d 100644 (file)
@@ -1,3 +1,18 @@
+2003-05-03  Jesper Harder  <harder@ifa.au.dk>
+
+       * gnus.el: Don't test for `mm-guess-mime-charset'.
+
+       * mm-util.el (mm-guess-mime-charset): Remove.  Not used any more.
+
+       * gnus.el (gnus-default-charset): Set default value to
+       `undecided'.
+
+       * gnus-art.el (article-decode-charset): Don't supply 4th arg to
+       mm-decode-body.
+
+       * mm-bodies.el (mm-decode-coding-region-safely): Remove.
+       (mm-decode-body): Don't use mm-decode-coding-region-safely.
+
 2003-05-03  Vasily Korytov <deskpot@despammed.com>  (tiny change)
 
        * gnus-util.el (gnus-multiple-choice): Add ", ?".
index 2ebebb6..1445d9f 100644 (file)
@@ -2108,7 +2108,7 @@ If PROMPT (the prefix), prompt for a coding system to use."
        (mm-decode-body
         charset (and cte (intern (downcase
                                   (gnus-strip-whitespace cte))))
-        (car ctl) prompt))))))
+        (car ctl)))))))
 
 (defun article-decode-encoded-words ()
   "Remove encoded-word encoding from headers."
index 7d840f3..e9b95d8 100644 (file)
 (require 'mm-util)
 (require 'nnheader)
 
-;; Make sure it was the right mm-util.
-(unless (fboundp 'mm-guess-mime-charset)
-  (error "Wrong `mm-util' found in `load-path'.  Make sure the Gnus one is found first."))
-
 (defgroup gnus nil
   "The coffee-brewing, all singing, all dancing, kitchen sink newsreader."
   :group 'news
@@ -2126,7 +2122,7 @@ You also need to enable `gnus-agent' for this to have any affect."
   :group 'gnus-agent
   :type 'boolean)
 
-(defcustom gnus-default-charset (mm-guess-mime-charset)
+(defcustom gnus-default-charset 'undecided
   "Default charset assumed to be used when viewing non-ASCII characters.
 This variable is overridden on a group-to-group basis by the
 `gnus-group-charset-alist' variable and is only used on groups not
index ee14049..c0686e2 100644 (file)
@@ -234,66 +234,41 @@ If TYPE is `text/plain' CRLF->LF translation may occur."
       (while (search-forward "\r\n" nil t)
        (replace-match "\n" t t)))))
 
-(defun mm-decode-body (charset &optional encoding type force)
+(defun mm-decode-body (charset &optional encoding type)
   "Decode the current article that has been encoded with ENCODING.
 The characters in CHARSET should then be decoded.  If FORCE is non-nil
 use the supplied charset unconditionally."
-  (let ((charset-supplied charset))
-    (when (stringp charset)
-      (setq charset (intern (downcase charset))))
-    (when (or (not charset)
-             (eq 'gnus-all mail-parse-ignored-charsets)
-             (memq 'gnus-all mail-parse-ignored-charsets)
-             (memq charset mail-parse-ignored-charsets))
-      (setq charset mail-parse-charset
-           charset-supplied nil))
-    (save-excursion
-      (when encoding
-       (mm-decode-content-transfer-encoding encoding type))
-      (when (featurep 'mule)
-       (let ((coding-system (mm-charset-to-coding-system charset)))
-         (if (and (not coding-system)
-                  (listp mail-parse-ignored-charsets)
-                  (memq 'gnus-unknown mail-parse-ignored-charsets))
-             (setq coding-system
-                   (mm-charset-to-coding-system mail-parse-charset)))
-         (when (and charset coding-system
-                    ;; buffer-file-coding-system
-                    ;;Article buffer is nil coding system
-                    ;;in XEmacs
-                    (mm-multibyte-p)
-                    (or (not (eq coding-system 'ascii))
-                        (setq coding-system mail-parse-charset))
-                    (not (eq coding-system 'gnus-decoded)))
-           (if (or force
-                   ;; If a charset was supplied, then use the
-                   ;; supplied charset unconditionally.
-                   charset-supplied)
-               (mm-decode-coding-region (point-min) (point-max)
-                                        coding-system)
-             ;; Otherwise allow Emacs to auto-detect the charset.
-             (mm-decode-coding-region-safely (point-min) (point-max)
-                                             coding-system)))
-         (setq buffer-file-coding-system
-               (if (boundp 'last-coding-system-used)
-                   (symbol-value 'last-coding-system-used)
-                 coding-system)))))))
-
-(defun mm-decode-coding-region-safely (start end coding-system)
-  "Decode region between START and END with CODING-SYSTEM.
-If CODING-SYSTEM is not a valid coding system for the text, let Emacs
-decide which coding system to use."
-  (let* ((orig (buffer-substring start end))
-        charsets)
-    (save-restriction
-      (narrow-to-region start end)
-      (mm-decode-coding-region (point-min) (point-max) coding-system)
-      (setq charsets (find-charset-region (point-min) (point-max)))
-      (when (or (memq 'eight-bit-control charsets)
-               (memq 'eight-bit-graphic charsets))
-       (delete-region (point-min) (point-max))
-       (insert orig)
-       (mm-decode-coding-region (point-min) (point-max) 'undecided)))))
+  (when (stringp charset)
+    (setq charset (intern (downcase charset))))
+  (when (or (not charset)
+           (eq 'gnus-all mail-parse-ignored-charsets)
+           (memq 'gnus-all mail-parse-ignored-charsets)
+           (memq charset mail-parse-ignored-charsets))
+    (setq charset mail-parse-charset))
+  (save-excursion
+    (when encoding
+      (mm-decode-content-transfer-encoding encoding type))
+    (when (featurep 'mule)
+      (let ((coding-system (mm-charset-to-coding-system charset)))
+       (if (and (not coding-system)
+                (listp mail-parse-ignored-charsets)
+                (memq 'gnus-unknown mail-parse-ignored-charsets))
+           (setq coding-system
+                 (mm-charset-to-coding-system mail-parse-charset)))
+       (when (and charset coding-system
+                  ;; buffer-file-coding-system
+                  ;;Article buffer is nil coding system
+                  ;;in XEmacs
+                  (mm-multibyte-p)
+                  (or (not (eq coding-system 'ascii))
+                      (setq coding-system mail-parse-charset))
+                  (not (eq coding-system 'gnus-decoded)))
+         (mm-decode-coding-region (point-min) (point-max)
+                                  coding-system))
+       (setq buffer-file-coding-system
+             (if (boundp 'last-coding-system-used)
+                 (symbol-value 'last-coding-system-used)
+               coding-system))))))
 
 (defun mm-decode-string (string charset)
   "Decode STRING with CHARSET."
index 7631e5e..6b1f47a 100644 (file)
@@ -768,30 +768,6 @@ If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'."
     (let ((cs (mm-detect-coding-region start end)))
       cs)))
 
-(defun mm-guess-mime-charset ()
-  "Guess the default MIME charset from the language environment."
-  (let ((language-info
-        (and (boundp 'current-language-environment)
-             (assoc current-language-environment
-                    language-info-alist)))
-       item)
-    (cond
-     ((null language-info)
-      'iso-8859-1)
-     ((setq item
-           (cadr
-            (or (assq 'coding-priority language-info)
-                (assq 'coding-system language-info))))
-      (if (fboundp 'coding-system-get)
-         (or (coding-system-get item 'mime-charset)
-             item)
-       item))
-     ((setq item (car (last (assq 'charset language-info))))
-      (if (eq item 'ascii)
-         'iso-8859-1
-       (mm-mime-charset item)))
-     (t
-      'iso-8859-1))))
 
 (provide 'mm-util)