changeset 24007:0e0b1cdfbfe3

(coding-system-change-eol-conversion, coding-system-change-text-conversion): Define them here. Remove the autoload cookies.
author Eli Zaretskii <eliz@gnu.org>
date Wed, 06 Jan 1999 10:25:34 +0000
parents 3d9e32528ca1
children 1d70b06238e8
files lisp/international/mule-cmds.el
diffstat 1 files changed, 42 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule-cmds.el	Wed Jan 06 10:24:17 1999 +0000
+++ b/lisp/international/mule-cmds.el	Wed Jan 06 10:25:34 1999 +0000
@@ -158,6 +158,48 @@
 ;;; ;; Here's an alternative key binding for X users (Shift-SPACE).
 ;;; (define-key global-map [?\S- ] 'toggle-input-method)
 
+(defun coding-system-change-eol-conversion (coding-system eol-type)
+  "Return a coding system which differs from CODING-SYSTEM in eol conversion.
+The returned coding system converts end-of-line by EOL-TYPE
+but text as the same way as CODING-SYSTEM.
+EOL-TYPE should be `unix', `dos', `mac', or nil.
+If EOL-TYPE is nil, the returned coding system detects
+how end-of-line is formatted automatically while decoding.
+
+EOL-TYPE can be specified by an integer 0, 1, or 2.
+They means `unix', `dos', and `mac' respectively."
+  (if (symbolp eol-type)
+      (setq eol-type (cond ((eq eol-type 'unix) 0)
+			   ((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))))))))
+
+(defun coding-system-change-text-conversion (coding-system coding)
+  "Return a coding system which differs from CODING-SYSTEM in text conversion.
+The returned coding system converts text by CODING
+but end-of-line as the same way as CODING-SYSTEM.
+If CODING is nil, the returned coding system detects
+how text is formatted automatically while decoding."
+  (if (not coding)
+      (coding-system-base coding-system)
+    (let ((eol-type (coding-system-eol-type coding-system)))
+      (coding-system-change-eol-conversion
+       coding
+       (if (numberp eol-type) (aref [unix dos mac] eol-type))))))
+
 (defun toggle-enable-multibyte-characters (&optional arg)
   "Change whether this buffer uses multibyte characters.
 With arg, use multibyte characters if the arg is positive.