comparison src/keymap.c @ 58271:8b3b0ccbe80b

(Fmap_keymap): New arg SORT-FIRST. Use map-keymap-internal to implement that.
author Richard M. Stallman <rms@gnu.org>
date Tue, 16 Nov 2004 17:00:59 +0000
parents 6f1bde62e20e
children 277e7a013eb6 2a3f27a45698 b637c617432f
comparison
equal deleted inserted replaced
58270:1bc0c9f25148 58271:8b3b0ccbe80b
726 void *dummy; 726 void *dummy;
727 { 727 {
728 call2 (fun, key, val); 728 call2 (fun, key, val);
729 } 729 }
730 730
731 DEFUN ("map-keymap", Fmap_keymap, Smap_keymap, 2, 2, 0, 731 DEFUN ("map-keymap", Fmap_keymap, Smap_keymap, 2, 3, 0,
732 doc: /* Call FUNCTION for every binding in KEYMAP. 732 doc: /* Call FUNCTION for every binding in KEYMAP.
733 FUNCTION is called with two arguments: the event and its binding. 733 FUNCTION is called with two arguments: the event and its binding.
734 If KEYMAP has a parent, the parent's bindings are included as well. 734 If KEYMAP has a parent, the parent's bindings are included as well.
735 This works recursively: if the parent has itself a parent, then the 735 This works recursively: if the parent has itself a parent, then the
736 grandparent's bindings are also included and so on. */) 736 grandparent's bindings are also included and so on.
737 (function, keymap) 737 usage: (map-keymap FUNCTION KEYMAP) */)
738 Lisp_Object function, keymap; 738 (function, keymap, sort_first)
739 Lisp_Object function, keymap, sort_first;
739 { 740 {
740 if (INTEGERP (function)) 741 if (INTEGERP (function))
741 /* We have to stop integers early since map_keymap gives them special 742 /* We have to stop integers early since map_keymap gives them special
742 significance. */ 743 significance. */
743 Fsignal (Qinvalid_function, Fcons (function, Qnil)); 744 Fsignal (Qinvalid_function, Fcons (function, Qnil));
745 if (! NILP (sort_first))
746 return call3 (intern ("map-keymap-internal"), function, keymap, Qt);
747
744 map_keymap (keymap, map_keymap_call, function, NULL, 1); 748 map_keymap (keymap, map_keymap_call, function, NULL, 1);
745 return Qnil; 749 return Qnil;
746 } 750 }
747 751
748 /* Given OBJECT which was found in a slot in a keymap, 752 /* Given OBJECT which was found in a slot in a keymap,