Function: xterm--init

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

Signature

(xterm--init)

Documentation

Initialize the terminal for xterm.

Source Code

;; Defined in /usr/src/emacs/lisp/term/xterm.el.gz
(defun xterm--init ()
  "Initialize the terminal for xterm."
  ;; rxvt terminals sometimes set the TERM variable to "xterm", but
  ;; rxvt's keybindings are incompatible with xterm's. It is
  ;; better in that case to use rxvt's initialization function.
  (if (and (getenv "COLORTERM" (selected-frame))
	   (string-match "\\`rxvt" (getenv "COLORTERM" (selected-frame))))
      (tty-run-terminal-initialization (selected-frame) "rxvt")

      (xterm--push-map xterm-alternatives-map local-function-key-map)
      (xterm--push-map xterm-function-map     input-decode-map))

  (xterm-register-default-colors xterm-standard-colors)
  (tty-set-up-initial-frame-faces)

  (if (eq xterm-extra-capabilities 'check)
      ;; Try to find out the type of terminal by sending a "Secondary
      ;; Device Attributes (DA)" query.
      (xterm--query "\e[>0c"
                    ;; Some terminals (like macOS's Terminal.app) respond to
                    ;; this query as if it were a "Primary Device Attributes"
                    ;; query instead, so we should handle that too.
                    '(("\e[?" . xterm--version-handler)
                      ("\e[>" . xterm--version-handler)))

    (when (memq 'reportBackground xterm-extra-capabilities)
      (xterm--query "\e]11;?\e\\"
                    '(("\e]11;" .  xterm--report-background-handler))))

    (when (memq 'modifyOtherKeys xterm-extra-capabilities)
      (xterm--init-modify-other-keys))

    (when (memq 'getSelection xterm-extra-capabilities)
      (xterm--init-activate-get-selection))
    (when (memq 'setSelection xterm-extra-capabilities)
      (xterm--init-activate-set-selection)))

  (when xterm-set-window-title
    (xterm--init-frame-title))
  (when (and (not xterm-mouse-mode-called)
             ;; Only automatically enable xterm mouse on terminals
             ;; confirmed to still support all critical editing
             ;; workflows (bug#74833).
             (or (string-match-p xterm--auto-xt-mouse-allowed-types
                                 (tty-type (selected-frame)))
                 (and-let* ((name-and-version (xterm--query-name-and-version)))
                   (string-match-p xterm--auto-xt-mouse-allowed-names
                                   name-and-version))))
    (xterm-mouse-mode 1))
  ;; Unconditionally enable bracketed paste mode: terminals that don't
  ;; support it just ignore the sequence.
  (xterm--init-bracketed-paste-mode)
  ;; We likewise unconditionally enable support for focus tracking.
  (xterm--init-focus-tracking))