]> git.eshelyaron.com Git - emacs.git/commitdiff
* international/mule-cmds.el (coding-system-change-eol-conversion):
authorChong Yidong <cyd@stupidchicken.com>
Thu, 5 Oct 2006 14:46:26 +0000 (14:46 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Thu, 5 Oct 2006 14:46:26 +0000 (14:46 +0000)
Ensure the coding system is initialized before calling
coding-system-eol-type.

lisp/ChangeLog
lisp/international/mule-cmds.el

index 6d70667a8d34af1eb3e94eac570e3d1fca89c73c..2b97c186a1cb4c72c0029a4d023f0dc241b7e29a 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-05  Chong Yidong  <cyd@stupidchicken.com>
+
+       * international/mule-cmds.el (coding-system-change-eol-conversion):
+       Ensure the coding system is initialized before calling
+       coding-system-eol-type.
+
 2006-10-04  Carsten Dominik  <dominik@science.uva.nl>
 
        * textmodes/org.el (org-rm-props, org-activate-plain-links) 
index 9adc4746b91b156eb6b5f818b812a17a8288fe3d..6edc0a4daac02ec0dd72997f135bdcec4e42aaa3 100644 (file)
@@ -216,19 +216,21 @@ They means `unix', `dos', and `mac' respectively."
                           ((eq eol-type 'dos) 1)
                           ((eq eol-type 'mac) 2)
                           (t eol-type))))
-  (let ((orig-eol-type (coding-system-eol-type coding-system)))
-    (if (vectorp orig-eol-type)
-       (if (not eol-type)
-           coding-system
-         (aref orig-eol-type eol-type))
-      (let ((base (coding-system-base coding-system)))
-       (if (not eol-type)
-           base
-         (if (= eol-type orig-eol-type)
-             coding-system
-           (setq orig-eol-type (coding-system-eol-type base))
-           (if (vectorp orig-eol-type)
-               (aref orig-eol-type eol-type))))))))
+  ;; We call `coding-system-base' before `coding-system-eol-type',
+  ;; because the coding-system may not be initialized until then.
+  (let* ((base (coding-system-base coding-system))
+        (orig-eol-type (coding-system-eol-type coding-system)))
+    (cond ((vectorp orig-eol-type)
+          (if (not eol-type)
+              coding-system
+            (aref orig-eol-type eol-type)))
+         ((not eol-type)
+          base)
+         ((= eol-type orig-eol-type)
+          coding-system)
+         ((progn (setq orig-eol-type (coding-system-eol-type base))
+                 (vectorp orig-eol-type))
+          (aref orig-eol-type eol-type)))))
 
 (defun coding-system-change-text-conversion (coding-system coding)
   "Return a coding system which differs from CODING-SYSTEM in text conversion.