changeset 17922:29d58e05d603

(substitute-key-definition): Handle chartables.
author Richard M. Stallman <rms@gnu.org>
date Thu, 22 May 1997 19:00:25 +0000
parents 4a4844821e04
children 986fa91361cc
files lisp/subr.el
diffstat 1 files changed, 38 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Thu May 22 10:51:45 1997 +0000
+++ b/lisp/subr.el	Thu May 22 19:00:25 1997 +0000
@@ -180,7 +180,44 @@
 			  (substitute-key-definition olddef newdef keymap
 						     inner-def
 						     prefix1)))))
-		(setq i (1+ i))))))
+		(setq i (1+ i))))
+	  (if (char-table-p (car scan))
+	      (map-char-table
+	       (function (lambda (char defn)
+			   (let ()
+			     ;; The inside of this let duplicates exactly
+			     ;; the inside of the previous let,
+			     ;; except that it uses set-char-table-range
+			     ;; instead of define-key.
+			     (aset vec1 0 char)
+			     (aset prefix1 (length prefix) char)
+			     (let (inner-def skipped)
+			       ;; Skip past menu-prompt.
+			       (while (stringp (car-safe defn))
+				 (setq skipped (cons (car defn) skipped))
+				 (setq defn (cdr defn)))
+			       (and (consp defn) (consp (car defn))
+				    (setq defn (cdr defn)))
+			       (setq inner-def defn)
+			       (while (and (symbolp inner-def)
+					   (fboundp inner-def))
+				 (setq inner-def (symbol-function inner-def)))
+			       (if (or (eq defn olddef)
+				       (and (or (stringp defn) (vectorp defn))
+					    (equal defn olddef)))
+				   (set-char-table-range (car scan)
+							 char
+							 (nconc (nreverse skipped) newdef))
+				 (if (and (keymapp defn)
+					  (let ((elt (lookup-key keymap prefix1)))
+					    (or (null elt)
+						(keymapp elt)))
+					  (not (memq inner-def
+						     key-substitution-in-progress)))
+				     (substitute-key-definition olddef newdef keymap
+								inner-def
+								prefix1)))))))
+	       (car scan)))))
       (setq scan (cdr scan)))))
 
 (defun define-key-after (keymap key definition after)