Function: reset-language-environment

reset-language-environment is an interactive and byte-compiled function defined in mule-cmds.el.gz.

Signature

(reset-language-environment)

Documentation

Reset multilingual environment of Emacs to the default status.

The default status is as follows:

  The default value of buffer-file-coding-system is nil.
  The default coding system for process I/O is nil.
  The default value for the command set-terminal-coding-system is nil.
  The default value for the command set-keyboard-coding-system is nil.

  The order of priorities of coding systems are as follows:
utf-8
iso-2022-7bit
iso-latin-1
iso-2022-7bit-lock
iso-2022-8bit-ss2
emacs-mule
raw-text

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule-cmds.el.gz
(defun reset-language-environment ()
  "Reset multilingual environment of Emacs to the default status.

The default status is as follows:

  The default value of `buffer-file-coding-system' is nil.
  The default coding system for process I/O is nil.
  The default value for the command `set-terminal-coding-system' is nil.
  The default value for the command `set-keyboard-coding-system' is nil.

  The order of priorities of coding systems are as follows:
	utf-8
	iso-2022-7bit
	iso-latin-1
	iso-2022-7bit-lock
	iso-2022-8bit-ss2
	emacs-mule
	raw-text"
  (interactive)
  ;; This function formerly set default-enable-multibyte-characters to t,
  ;; but that is incorrect.  It should not alter the unibyte/multibyte choice.

  (set-coding-system-priority
   'utf-8
   'iso-2022-7bit
   'iso-latin-1
   'iso-2022-7bit-lock
   'iso-2022-8bit-ss2
   'emacs-mule
   'raw-text)

  (set-default-coding-systems nil)
  (setq default-sendmail-coding-system 'utf-8)
  (setq default-file-name-coding-system (if (memq system-type
                                                  '(windows-nt ms-dos))
                                            'iso-latin-1-unix
                                          'utf-8-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
	 ;; When bootstrapping, coding-systems are not defined yet, so
	 ;; we need to catch the error from check-coding-system.
	 (condition-case nil
	     (coding-system-change-text-conversion
	      (car default-process-coding-system) 'undecided)
	   (coding-system-error 'undecided)))
	(input-coding
	 (condition-case nil
	     (coding-system-change-text-conversion
	      (cdr default-process-coding-system)
	      (if (memq system-type '(windows-nt ms-dos)) 'iso-latin-1 'utf-8))
	   (coding-system-error
	    (if (memq system-type '(windows-nt ms-dos)) 'iso-latin-1 'utf-8)))))
    (setq default-process-coding-system
	  (cons output-coding input-coding)))

  ;; Put the highest priority to the charset iso-8859-1 to prefer the
  ;; registry iso8859-1 over iso8859-2 in font selection.  It also
  ;; makes unibyte-display-via-language-environment to use iso-8859-1
  ;; as the unibyte charset.
  (set-charset-priority 'iso-8859-1)

  ;; Don't alter the terminal and keyboard coding systems here.
  ;; The terminal still supports the same coding system
  ;; that it supported a minute ago.
  ;; (set-terminal-coding-system-internal nil)
  ;; (set-keyboard-coding-system-internal nil)

  ;; Back in Emacs-20, it was necessary to provide some fallback implicit
  ;; conversion, because almost no packages handled coding-system issues.
  ;; Nowadays it'd just paper over bugs.
  ;; (set-unibyte-charset 'iso-8859-1)
  )