diff options
| author | Richard M. Stallman | 2004-11-16 17:05:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-11-16 17:05:18 +0000 |
| commit | 14694a594bdd37507a8b3861fbf6387b60b742cb (patch) | |
| tree | 299ee946bfbb0e6ea6296d507c806d2de58316ab | |
| parent | 0ea6ae0a0c3dccd2277a7500163d0145aeb39d94 (diff) | |
| download | emacs-14694a594bdd37507a8b3861fbf6387b60b742cb.tar.gz emacs-14694a594bdd37507a8b3861fbf6387b60b742cb.zip | |
(map-keymap-internal): New function.
| -rw-r--r-- | lisp/subr.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index d2b836a5e4f..c8dfedbd8c6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -484,6 +484,24 @@ The order of bindings in a keymap matters when it is used as a menu." | |||
| 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. |