comparison src/keymap.c @ 489:4a8bb4aa9740

[xemacs-hg @ 2001-04-30 08:49:24 by martinb] hash table mapping
author martinb
date Mon, 30 Apr 2001 08:49:26 +0000
parents 5aa1854ad537
children 7039e6323819
comparison
equal deleted inserted replaced
488:1e7b510d04f6 489:4a8bb4aa9740
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, gcpro3; 2993 struct gcpro gcpro1, gcpro2;
2994 Lisp_Object table = Qnil;
2995 2994
2996 /* tolerate obviously transposed args */ 2995 /* tolerate obviously transposed args */
2997 if (!NILP (Fkeymapp (function))) 2996 if (!NILP (Fkeymapp (function)))
2998 { 2997 {
2999 Lisp_Object tmp = function; 2998 Lisp_Object tmp = function;
3000 function = keymap; 2999 function = keymap;
3001 keymap = tmp; 3000 keymap = tmp;
3002 } 3001 }
3003 3002 GCPRO2 (function, keymap);
3004 GCPRO3 (function, keymap, table);
3005 keymap = get_keymap (keymap, 1, 1); 3003 keymap = get_keymap (keymap, 1, 1);
3006 3004 map_keymap (XKEYMAP (keymap)->table, !NILP (sort_first),
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),
3014 map_keymap_mapper, LISP_TO_VOID (function)); 3005 map_keymap_mapper, LISP_TO_VOID (function));
3015 UNGCPRO; 3006 UNGCPRO;
3016 return Qnil; 3007 return Qnil;
3017 } 3008 }
3018 3009