Function: coding-system-change-eol-conversion

coding-system-change-eol-conversion is a byte-compiled function defined in mule-cmds.el.gz.

Signature

(coding-system-change-eol-conversion CODING-SYSTEM EOL-TYPE)

Documentation

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.

Probably introduced at or before Emacs version 20.3.

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule-cmds.el.gz
(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))))
  ;; 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)))))