comparison src/keymap.c @ 464:5aa1854ad537 r21-2-47

Import from CVS: tag r21-2-47
author cvs
date Mon, 13 Aug 2007 11:45:51 +0200
parents c33ae14dd6d0
children 4a8bb4aa9740
comparison
equal deleted inserted replaced
463:a158004111cd 464:5aa1854ad537
2988 faster. 2988 faster.
2989 */ 2989 */
2990 (function, keymap, sort_first)) 2990 (function, keymap, sort_first))
2991 { 2991 {
2992 /* This function can GC */ 2992 /* This function can GC */
2993 struct gcpro gcpro1, gcpro2; 2993 struct gcpro gcpro1, gcpro2, gcpro3;
2994 Lisp_Object table = Qnil;
2994 2995
2995 /* tolerate obviously transposed args */ 2996 /* tolerate obviously transposed args */
2996 if (!NILP (Fkeymapp (function))) 2997 if (!NILP (Fkeymapp (function)))
2997 { 2998 {
2998 Lisp_Object tmp = function; 2999 Lisp_Object tmp = function;
2999 function = keymap; 3000 function = keymap;
3000 keymap = tmp; 3001 keymap = tmp;
3001 } 3002 }
3002 GCPRO2 (function, keymap); 3003
3004 GCPRO3 (function, keymap, table);
3003 keymap = get_keymap (keymap, 1, 1); 3005 keymap = get_keymap (keymap, 1, 1);
3004 map_keymap (XKEYMAP (keymap)->table, !NILP (sort_first), 3006
3007 /* elisp_maphash does not allow mapping functions to modify the hash
3008 table being mapped over. Since map-keymap explicitly allows a
3009 mapping function to modify KEYMAP, we map over a copy of the hash
3010 table instead. */
3011 table = Fcopy_hash_table (XKEYMAP (keymap)->table);
3012
3013 map_keymap (table, !NILP (sort_first),
3005 map_keymap_mapper, LISP_TO_VOID (function)); 3014 map_keymap_mapper, LISP_TO_VOID (function));
3006 UNGCPRO; 3015 UNGCPRO;
3007 return Qnil; 3016 return Qnil;
3008 } 3017 }
3009 3018