changeset 89882:a42353ac8046

(rmail-decode-babyl-format): Use with-coding-priority instead of detect-coding-with-priority.
author Kenichi Handa <handa@m17n.org>
date Fri, 09 Apr 2004 00:25:07 +0000
parents a8e1efb65ccf
children e5ffb48165ab
files lisp/mail/rmail.el
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Thu Apr 08 11:56:07 2004 +0000
+++ b/lisp/mail/rmail.el	Fri Apr 09 00:25:07 2004 +0000
@@ -784,17 +784,17 @@
     (unless (and coding-system
 		 (coding-system-p coding-system))
       (setq coding-system
-	    ;; Emacs 21.1 and later writes RMAIL files in emacs-mule, but
-	    ;; earlier versions did that with the current buffer's encoding.
-	    ;; So we want to favor detection of emacs-mule (whose normal
-	    ;; priority is quite low), but still allow detection of other
-	    ;; encodings if emacs-mule won't fit.  The call to
-	    ;; detect-coding-with-priority below achieves that.
-	    (car (detect-coding-with-priority
-		  from to
-		  '((coding-category-emacs-mule . emacs-mule))))))
-    (unless (memq coding-system
-		  '(undecided undecided-unix))
+	    ;; If rmail-file-coding-system is nil, Emacs 21 writes
+	    ;; RMAIL files in emacs-mule, Emacs 22 in utf-8, but
+	    ;; earlier versions did that with the current buffer's
+	    ;; encoding.  So we want to favor detection of emacs-mule
+	    ;; (whose normal priority is quite low) and utf-8, but
+	    ;; still allow detection of other encodings if they won't
+	    ;; fit.  The call to with-coding-priority below achieves
+	    ;; that.
+	    (with-coding-priority '(emacs-mule utf-8)
+	      (detect-coding-region from to 'highest))))
+    (unless (eq (coding-system-type coding-system) 'undecided)
       (set-buffer-modified-p t)		; avoid locking when decoding
       (let ((buffer-undo-list t))
 	(decode-coding-region from to coding-system))