Commit 8bed5e3d authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(keyboard-translate): Use a char-table.

(keyboard-translate-table): Add char-table-extra-slots property.
parent d7b43eaa
......@@ -213,22 +213,15 @@ a string or vector of length 1."
(setq inserted t)))
(setq tail (cdr tail)))))
(put 'keyboard-translate-table 'char-table-extra-slots 0)
(defun keyboard-translate (from to)
"Translate character FROM to TO at a low level.
This function creates a `keyboard-translate-table' if necessary
and then modifies one entry in it."
(or (arrayp keyboard-translate-table)
(setq keyboard-translate-table ""))
(if (or (> from (length keyboard-translate-table))
(> to (length keyboard-translate-table)))
(let* ((i (length keyboard-translate-table))
(table (concat keyboard-translate-table
(make-string (- 256 i) 0))))
(while (< i 256)
(aset table i i)
(setq i (1+ i)))
(setq keyboard-translate-table table))))
(or (char-table-p keyboard-translate-table)
(setq keyboard-translate-table
(make-char-table 'keyboard-translate-table nil)))
(aset keyboard-translate-table from to))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment