Function: set-default-coding-systems

set-default-coding-systems is a byte-compiled function defined in mule-cmds.el.gz.

Signature

(set-default-coding-systems CODING-SYSTEM)

Documentation

Set default value of various coding systems to CODING-SYSTEM.

This sets the following coding systems:
  o coding system of a newly created buffer
  o default coding system for subprocess I/O
This also sets the following values:
  o default value used as file-name-coding-system for converting file names
      if CODING-SYSTEM is ASCII-compatible
  o default value for the command set-terminal-coding-system
  o default value for the command set-keyboard-coding-system
      if CODING-SYSTEM is ASCII-compatible

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule-cmds.el.gz
(defun set-default-coding-systems (coding-system)
  "Set default value of various coding systems to CODING-SYSTEM.
This sets the following coding systems:
  o coding system of a newly created buffer
  o default coding system for subprocess I/O
This also sets the following values:
  o default value used as `file-name-coding-system' for converting file names
      if CODING-SYSTEM is ASCII-compatible
  o default value for the command `set-terminal-coding-system'
  o default value for the command `set-keyboard-coding-system'
      if CODING-SYSTEM is ASCII-compatible"
  (check-coding-system coding-system)
  (setq-default buffer-file-coding-system coding-system)
  (if (or (eq system-type 'darwin)
          (eq system-type 'android))
      ;; The file-name coding system on Darwin and Android systems is
      ;; always UTF-8.
      (setq default-file-name-coding-system 'utf-8-unix)
    (if (and (or (not coding-system)
		 (coding-system-get coding-system 'ascii-compatible-p)))
	(setq default-file-name-coding-system
	      (coding-system-change-eol-conversion coding-system 'unix))))
  (setq default-terminal-coding-system coding-system)
  ;; Prevent default-terminal-coding-system from converting ^M to ^J.
  (setq default-keyboard-coding-system
	(coding-system-change-eol-conversion coding-system 'unix))
  ;; Preserve eol-type from existing default-process-coding-systems.
  ;; On non-unix-like systems in particular, these may have been set
  ;; carefully by the user, or by the startup code, to deal with the
  ;; users shell appropriately, so should not be altered by changing
  ;; language environment.
  (let ((output-coding
	 (coding-system-change-text-conversion
	  (car default-process-coding-system) coding-system))
	(input-coding
	 (coding-system-change-text-conversion
	  (cdr default-process-coding-system) coding-system)))
    (setq default-process-coding-system
	  (cons output-coding input-coding))))