Function: key-translate

key-translate is a byte-compiled function defined in keymap.el.gz.

Signature

(key-translate FROM TO)

Documentation

Translate character FROM to TO on the current terminal.

This function creates a keyboard-translate-table if necessary and then modifies one entry in it.

Both FROM and TO should be specified by strings that satisfy key-valid-p.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/keymap.el.gz
(defun key-translate (from to)
  "Translate character FROM to TO on the current terminal.
This function creates a `keyboard-translate-table' if necessary
and then modifies one entry in it.

Both FROM and TO should be specified by strings that satisfy `key-valid-p'."
  (declare (compiler-macro
            (lambda (form) (keymap--compile-check from to) form)))
  (keymap--check from)
  (keymap--check to)
  (or (char-table-p keyboard-translate-table)
      (setq keyboard-translate-table
            (make-char-table 'keyboard-translate-table nil)))
  (aset keyboard-translate-table
        (aref (key-parse from) 0)
        (aref (key-parse to) 0)))