comparison lisp/subr.el @ 58272:ca2809f6625b

(map-keymap-internal): New function.
author Richard M. Stallman <rms@gnu.org>
date Tue, 16 Nov 2004 17:05:18 +0000
parents a683f1bc6fbe
children 28906724d6e3 2a3f27a45698 b637c617432f
comparison
equal deleted inserted replaced
58271:8b3b0ccbe80b 58272:ca2809f6625b
482 (or inserted 482 (or inserted
483 (setcdr tail (cons (cons key definition) (cdr tail)))) 483 (setcdr tail (cons (cons key definition) (cdr tail))))
484 (setq inserted t))) 484 (setq inserted t)))
485 (setq tail (cdr tail))))) 485 (setq tail (cdr tail)))))
486 486
487 (defun map-keymap-internal (function keymap &optional sort-first)
488 "Implement `map-keymap' with sorting.
489 Don't call this function; it is for internal use only."
490 (if sort-first
491 (let (list)
492 (map-keymap (lambda (a b) (push (cons a b) list))
493 keymap)
494 (setq list (sort list
495 (lambda (a b)
496 (setq a (car a) b (car b))
497 (if (integerp a)
498 (if (integerp b) (< a b)
499 t)
500 (if (integerp b) t
501 (string< a b))))))
502 (dolist (p list)
503 (funcall function (car p) (cdr p))))
504 (map-keymap function keymap)))
487 505
488 (defmacro kbd (keys) 506 (defmacro kbd (keys)
489 "Convert KEYS to the internal Emacs key representation. 507 "Convert KEYS to the internal Emacs key representation.
490 KEYS should be a string constant in the format used for 508 KEYS should be a string constant in the format used for
491 saving keyboard macros (see `edmacro-mode')." 509 saving keyboard macros (see `edmacro-mode')."