Function: terminal-init-w32console

terminal-init-w32console is a byte-compiled function defined in w32console.el.gz.

Signature

(terminal-init-w32console)

Documentation

Terminal initialization function for w32 console.

Source Code

;; Defined in /usr/src/emacs/lisp/term/w32console.el.gz
(defun terminal-init-w32console ()
  "Terminal initialization function for w32 console."
  ;; Share function key initialization with w32 gui frames
  (x-setup-function-keys (selected-frame))
  ;; Set terminal and keyboard encodings to the current OEM codepage.
  (let ((oem-code-page-coding
	 (intern (format "cp%d" (w32-get-console-codepage))))
	(oem-code-page-output-coding
	 (intern (format "cp%d" (w32-get-console-output-codepage))))
	oem-cs-p oem-o-cs-p)
	(setq oem-cs-p (coding-system-p oem-code-page-coding))
	(setq oem-o-cs-p (coding-system-p oem-code-page-output-coding))
	(when oem-cs-p
	  (set-keyboard-coding-system oem-code-page-coding)
	  (set-terminal-coding-system
	   (if oem-o-cs-p oem-code-page-output-coding oem-code-page-coding))
          ;; Since we changed the terminal encoding, we need to repeat
          ;; the test for Unicode quotes being displayable.
          (startup--setup-quote-display)))
  (let* ((colors w32-tty-standard-colors)
         (color (car colors)))
    (tty-color-clear)
    (while colors
      (tty-color-define (car color) (cadr color) (cddr color))
      (setq colors (cdr colors)
            color (car colors))))
  (clear-face-cache)
  ;; Figure out what are the colors of the console window, and set up
  ;; the background-mode correspondingly.
  (let* ((screen-color (get-screen-color))
	 (bg (cadr screen-color))
	 (descr (tty-color-by-index bg))
	 r g b bg-mode)
    (setq r (nth 2 descr)
	  g (nth 3 descr)
	  b (nth 4 descr))
    (if (< (+ r g b) (* .6 (+ 65535 65535 65535)))
	(setq bg-mode 'dark)
      (setq bg-mode 'light))
    (set-terminal-parameter nil 'background-mode bg-mode))
  (tty-set-up-initial-frame-faces)
  (run-hooks 'terminal-init-w32-hook))