Mercurial > emacs
changeset 2168:af8f27940f79
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Sun, 14 Mar 1993 05:50:49 +0000 |
parents | c4bed8692d6f |
children | 2484b562777f |
files | lisp/emacs-lisp/lucid.el |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emacs-lisp/lucid.el Sun Mar 14 05:40:29 1993 +0000 +++ b/lisp/emacs-lisp/lucid.el Sun Mar 14 05:50:49 1993 +0000 @@ -44,3 +44,20 @@ (if (eq (nth 2 plist) prop) (setcdr (cdr plist) (nthcdr 4 plist))) (setq plist (cdr (cdr plist)))))) + +(defun map-keymap (function keymap) + "Call FUNCTION for every binding in KEYMAP. +This includes bindings inherited from a parent keymap. +FUNCTION receives two arguments each time it is called: +the character (more generally, the event type) that is bound, +and the binding it has." + (while (consp keymap) + (if (consp (car keymap)) + (funcall function (car (car keymap)) (cdr (car keymap))) + (if (vectorp (car keymap)) + (let ((i (length (car keymap))) + (vector (car keymap))) + (while (>= i 0) + (funcall function i (aref vector i)) + (setq i (1- i)))))) + (setq keymap (cdr keymap))))