changeset 15894:efd2835a7c96

(keyboard-translate): Use a char-table. (keyboard-translate-table): Add char-table-extra-slots property.
author Richard M. Stallman <rms@gnu.org>
date Wed, 21 Aug 1996 20:36:30 +0000
parents 56d0b28891da
children 85112cca0b22
files lisp/subr.el
diffstat 1 files changed, 5 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Wed Aug 21 20:18:00 1996 +0000
+++ b/lisp/subr.el	Wed Aug 21 20:36:30 1996 +0000
@@ -213,22 +213,15 @@
 	    (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)))
-      (progn
-	(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))