Mercurial > emacs
comparison lisp/emacs-lisp/lucid.el @ 58273:803b8e8a1c6d
(map-keymap): Definition deleted.
(cl-map-keymap): Definition deleted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 16 Nov 2004 17:06:56 +0000 |
parents | 695cf19ef79e |
children | 18a818a2ee7c b637c617432f |
comparison
equal
deleted
inserted
replaced
58272:ca2809f6625b | 58273:803b8e8a1c6d |
---|---|
28 | 28 |
29 ;; XEmacs autoloads CL so we might as well make use of it. | 29 ;; XEmacs autoloads CL so we might as well make use of it. |
30 (require 'cl) | 30 (require 'cl) |
31 | 31 |
32 (defalias 'current-time-seconds 'current-time) | 32 (defalias 'current-time-seconds 'current-time) |
33 | |
34 ;; In case cl-map-keymap is an alias for map-keymap, avoid circular calls. | |
35 (fset 'cl-map-keymap (indirect-function 'cl-map-keymap)) | |
36 | |
37 (defun map-keymap (function keymap &optional sort-first) | |
38 "Call FUNCTION for every binding in KEYMAP. | |
39 This does not include bindings inherited from a parent keymap. | |
40 FUNCTION receives two arguments each time it is called: | |
41 the character (more generally, the event type) that is bound, | |
42 and the binding it has. | |
43 | |
44 Note that passing the event type directly to `define-key' does not work | |
45 in Emacs 19. We do not emulate that particular feature of Lucid Emacs. | |
46 If your code does that, modify it to make a vector containing the event | |
47 type that you get. That will work in both versions of Emacs." | |
48 (if sort-first | |
49 (let (list) | |
50 (cl-map-keymap (lambda (a b) (push (cons a b) list)) | |
51 keymap) | |
52 (setq list (sort list | |
53 (lambda (a b) | |
54 (setq a (car a) b (car b)) | |
55 (if (integerp a) | |
56 (if (integerp b) (< a b) | |
57 t) | |
58 (if (integerp b) t | |
59 (string< a b)))))) | |
60 (dolist (p list) | |
61 (funcall function (car p) (cdr p)))) | |
62 (cl-map-keymap function keymap))) | |
63 | 33 |
64 (defun read-number (prompt &optional integers-only) | 34 (defun read-number (prompt &optional integers-only) |
65 "Read a number from the minibuffer. | 35 "Read a number from the minibuffer. |
66 Keep reentering the minibuffer until we get suitable input. | 36 Keep reentering the minibuffer until we get suitable input. |
67 If optional argument INTEGERS-ONLY is non-nil, insist on an integer." | 37 If optional argument INTEGERS-ONLY is non-nil, insist on an integer." |