Mercurial > emacs
changeset 58272:ca2809f6625b
(map-keymap-internal): New function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 16 Nov 2004 17:05:18 +0000 |
parents | 8b3b0ccbe80b |
children | 803b8e8a1c6d |
files | lisp/subr.el |
diffstat | 1 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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.