diff src/keyboard.c @ 32988:c3435dc00ed7

* lisp.h (KEYMAPP): New macro. (get_keymap): Remove. (get_keymap_1): Rename get_keymap. * keyboard.h (get_keymap_1, Fkeymapp): Remove prototype. * xterm.c (note_mode_line_highlight): Use KEYMAPP. * xmenu.c (single_submenu): Use KEYMAPP. (Fx_popup_menu): Fetch keymaps rather than checking Fkeymapp. Use KEYMAPP rather than Fkeymapp. * w32term.c (note_mode_line_highlight): Use KEYMAPP. * w32menu.c (True, False): Remove (use TRUE and FALSE instead). (Fx_popup_menu): Fetch keymaps rather than checking Fkeymapp. Use KEYMAPP rather than Fkeymapp. (single_submenu): Use KEYMAPP. (w32_menu_show, w32_dialog_show): Use TRUE. * minibuf.c (Fread_from_minibuffer): Update call to get_keymap. * keymap.c (KEYMAPP): Remove (moved to lisp.h). (Fkeymapp): Use KEYMAPP. (get_keymap): Rename from get_keymap_1. Remove old def. Return t when autoload=0 and error=0 and the keymap needs autoloading. (Fcopy_keymap): Check (eq (car x) 'keymap) rather than using Fkeymapp. (Fminor_mode_key_binding): Don't raise an error if the binding is not a keymap. (Fuse_global_map, Fuse_local_map): Allow autoloading. (Faccessible_keymaps): Fetch keymaps rather than checking Fkeymapp. * keyboard.c (read_char): get_keymap_1 -> get_keymap. Allow Vspecial_event_map to be autoloaded. (menu_bar_items): Fetch the keymap rather than using keymapp. (menu_bar_one_keymap): No need to follow func-indirect any more. (parse_menu_item): get_keymap_1 -> get_keymap. (tool_bar_items): Fetch the keymap rather than using keymapp. (read_key_sequence): Use KEYMAPP. * intervals.c (get_local_map): Use get_keymap rather than following function-indirections explicitly. * doc.c (Fsubstitute_command_keys): get_keymap_1 -> get_keymap.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 27 Oct 2000 22:20:19 +0000
parents 923b8d6d8277
children a4b7690c68da
line wrap: on
line diff
--- a/src/keyboard.c	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/keyboard.c	Fri Oct 27 22:20:19 2000 +0000
@@ -2574,7 +2574,7 @@
      and loop around to read another event.  */
   save = Vquit_flag;
   Vquit_flag = Qnil;
-  tem = access_keymap (get_keymap_1 (Vspecial_event_map, 0, 0), c, 0, 0, 1);
+  tem = access_keymap (get_keymap (Vspecial_event_map, 0, 1), c, 0, 0, 1);
   Vquit_flag = save;
 
   if (!NILP (tem))
@@ -6259,9 +6259,9 @@
   for (mapno = nmaps - 1; mapno >= 0; mapno--)
     if (!NILP (maps[mapno]))
       {
-	def = access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0);
-	tem = Fkeymapp (def);
-	if (!NILP (tem))
+	def = get_keymap (access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0),
+			  0, 0);
+	if (CONSP (def))
 	  menu_bar_one_keymap (def);
       }
 
@@ -6327,11 +6327,6 @@
 {
   Lisp_Object tail, item;
 
-  /* If KEYMAP is a symbol, its function definition is the keymap
-     to use.  */
-  if (SYMBOLP (keymap))
-    keymap = indirect_function (keymap);
-
   menu_bar_one_keymap_changed_items = Qnil;
 
   /* Loop over all keymap entries that have menu strings.  */
@@ -6661,9 +6656,9 @@
 
   /* See if this is a separate pane or a submenu.  */
   def = AREF (item_properties, ITEM_PROPERTY_DEF);
-  tem = get_keymap_1 (def, 0, 1);
+  tem = get_keymap (def, 0, 1);
   /* For a subkeymap, just record its details and exit.  */
-  if (!NILP (tem))
+  if (CONSP (tem))
     {
       AREF (item_properties, ITEM_PROPERTY_MAP) = tem;
       AREF (item_properties, ITEM_PROPERTY_DEF) = tem;
@@ -6918,16 +6913,11 @@
 	Lisp_Object keymap;
 
 	/* Why set the `noinherit' flag ?  -sm  */
-	keymap = access_keymap (maps[i], Qtool_bar, 1, 1, 0);
-	if (!NILP (Fkeymapp (keymap)))
+	keymap = get_keymap (access_keymap (maps[i], Qtool_bar, 1, 1, 0), 0, 0);
+	if (CONSP (keymap))
 	  {
 	    Lisp_Object tail;
 	    
-	    /* If KEYMAP is a symbol, its function definition is the
-	       keymap to use.  */
-	    if (SYMBOLP (keymap))
-	      keymap = indirect_function (keymap);
-
 	    /* KEYMAP is a list `(keymap (KEY . BINDING) ...)'.  */
 	    for (tail = keymap; CONSP (tail); tail = XCDR (tail))
 	      {
@@ -7144,7 +7134,7 @@
 					       PROP (TOOL_BAR_ITEM_BINDING))));
 
   /* See if the binding is a keymap.  Give up if it is.  */
-  if (!NILP (get_keymap_1 (PROP (TOOL_BAR_ITEM_BINDING), 0, 1)))
+  if (CONSP (get_keymap (PROP (TOOL_BAR_ITEM_BINDING), 0, 1)))
     return 0;
 
   /* Enable or disable selection of item.  */
@@ -7627,7 +7617,7 @@
   /* Given the set of bindings we've found, produce the next set of maps.  */
   if (first_binding < nmaps)
     for (i = 0; i < nmaps; i++)
-      next[i] = NILP (defs[i]) ? Qnil : get_keymap_1 (defs[i], 0, 1);
+      next[i] = NILP (defs[i]) ? Qnil : get_keymap (defs[i], 0, 1);
 
   return first_binding;
 }
@@ -7793,11 +7783,11 @@
   keytran_map = Vkey_translation_map;
 
   /* If there is no function-key-map, turn off function key scanning.  */
-  if (NILP (Fkeymapp (Vfunction_key_map)))
+  if (!KEYMAPP (Vfunction_key_map))
     fkey_start = fkey_end = bufsize + 1;
 
   /* If there is no key-translation-map, turn off scanning.  */
-  if (NILP (Fkeymapp (Vkey_translation_map)))
+  if (!KEYMAPP (Vkey_translation_map))
     keytran_start = keytran_end = bufsize + 1;
 
   if (INTERACTIVE)
@@ -8452,7 +8442,7 @@
 		 or an array.  */
 	      if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next))
 		  && (!NILP (Farrayp (XSYMBOL (fkey_next)->function))
-		      || !NILP (Fkeymapp (XSYMBOL (fkey_next)->function))))
+		      || KEYMAPP (XSYMBOL (fkey_next)->function)))
 		fkey_next = XSYMBOL (fkey_next)->function;
 
 #if 0 /* I didn't turn this on, because it might cause trouble
@@ -8525,11 +8515,11 @@
 		  goto replay_sequence;
 		}
 
-	      fkey_map = get_keymap_1 (fkey_next, 0, 1);
+	      fkey_map = get_keymap (fkey_next, 0, 1);
 
 	      /* If we no longer have a bound suffix, try a new positions for
 		 fkey_start.  */
-	      if (NILP (fkey_map))
+	      if (!CONSP (fkey_map))
 		{
 		  fkey_end = ++fkey_start;
 		  fkey_map = Vfunction_key_map;
@@ -8562,7 +8552,7 @@
 	       or an array.  */
 	    if (SYMBOLP (keytran_next) && ! NILP (Ffboundp (keytran_next))
 		&& (!NILP (Farrayp (XSYMBOL (keytran_next)->function))
-		    || !NILP (Fkeymapp (XSYMBOL (keytran_next)->function))))
+		    || KEYMAPP (XSYMBOL (keytran_next)->function)))
 	      keytran_next = XSYMBOL (keytran_next)->function;
 	    
 	    /* If the key translation map gives a function, not an
@@ -8626,11 +8616,11 @@
 		goto replay_sequence;
 	      }
 
-	    keytran_map = get_keymap_1 (keytran_next, 0, 1);
+	    keytran_map = get_keymap (keytran_next, 0, 1);
 
 	    /* If we no longer have a bound suffix, try a new positions for
 	       keytran_start.  */
-	    if (NILP (keytran_map))
+	    if (!CONSP (keytran_map))
 	      {
 		keytran_end = ++keytran_start;
 		keytran_map = Vkey_translation_map;