(mm-coding-system-p): Return a coding-system.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 28 Jun 2004 11:52:45 +0000 (11:52 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 28 Jun 2004 11:52:45 +0000 (11:52 +0000)
(mm-sort-coding-systems-predicate): Fix previous commit.

lisp/ChangeLog
lisp/mm-util.el

index 0618883..7f4b87e 100644 (file)
@@ -1,7 +1,8 @@
 2004-06-28  Katsumi Yamaoka  <yamaoka@jpl.org>
 
-       * mm-util.el (mm-mime-mule-charset-alist): Use shift_jis instead
-       of iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new
+       * mm-util.el (mm-coding-system-p): Return a coding-system.
+       (mm-mime-mule-charset-alist): Use shift_jis instead of
+       iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new
        entries for the mime charsets iso-2022-jp-3 and shift_jis.
        (mm-coding-system-priorities): Use shift_jis and iso-8859-1
        instead of japanese-shift-jis and iso-latin-1 respectively in
index b25cf23..ac712b7 100644 (file)
 
 (defun mm-coding-system-p (cs)
   "Return non-nil if CS is a symbol naming a coding system.
-In XEmacs, also return non-nil if CS is a coding system object."
+In XEmacs, also return non-nil if CS is a coding system object.
+If CS is available, return CS itself in Emacs, and return a coding
+system object in XEmacs."
   (if (fboundp 'find-coding-system)
       (find-coding-system cs)
     (if (fboundp 'coding-system-p)
-       (coding-system-p cs)
+       (when (coding-system-p cs)
+         cs)
       ;; Is this branch ever actually useful?
-      (memq cs (mm-get-coding-system-list)))))
+      (car (memq cs (mm-get-coding-system-list))))))
 
 (defvar mm-charset-synonym-alist
   `(
@@ -538,14 +541,11 @@ This affects whether coding conversion should be attempted generally."
        (not inconvertible))))
 
 (defun mm-sort-coding-systems-predicate (a b)
-  (let ((priorities
-        (mapcar (lambda (cs)
-                  ;; Note: invalid entries are dropped silently
-                  (and (mm-coding-system-p cs)
-                       (coding-system-base cs)))
-                mm-coding-system-priorities)))
-    (and (mm-coding-system-p a)
-        (if (mm-coding-system-p b)
+  (let ((priorities (mapcar 'mm-coding-system-p
+                           ;; Note: invalid entries are dropped silently
+                           mm-coding-system-priorities)))
+    (and (setq a (mm-coding-system-p a))
+        (if (setq b (mm-coding-system-p b))
             (> (length (memq (coding-system-base a) priorities))
                (length (memq (coding-system-base b) priorities)))
           t))))