# HG changeset patch # User Richard M. Stallman # Date 1100624718 0 # Node ID ca2809f6625b83831d89e3052afecf820b56f3f8 # Parent 8b3b0ccbe80b82e483df14447cafc4c1619d5424 (map-keymap-internal): New function. diff -r 8b3b0ccbe80b -r ca2809f6625b lisp/subr.el --- a/lisp/subr.el Tue Nov 16 17:00:59 2004 +0000 +++ b/lisp/subr.el Tue Nov 16 17:05:18 2004 +0000 @@ -484,6 +484,24 @@ (setq inserted t))) (setq tail (cdr tail))))) +(defun map-keymap-internal (function keymap &optional sort-first) + "Implement `map-keymap' with sorting. +Don't call this function; it is for internal use only." + (if sort-first + (let (list) + (map-keymap (lambda (a b) (push (cons a b) list)) + keymap) + (setq list (sort list + (lambda (a b) + (setq a (car a) b (car b)) + (if (integerp a) + (if (integerp b) (< a b) + t) + (if (integerp b) t + (string< a b)))))) + (dolist (p list) + (funcall function (car p) (cdr p)))) + (map-keymap function keymap))) (defmacro kbd (keys) "Convert KEYS to the internal Emacs key representation.