changeset 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 a2813d16337d
children 74484f2d629a
files src/ChangeLog src/doc.c src/intervals.c src/keyboard.c src/keyboard.h src/keymap.c src/lisp.h src/minibuf.c src/w32menu.c src/w32term.c src/xmenu.c src/xterm.c
diffstat 12 files changed, 174 insertions(+), 170 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/ChangeLog	Fri Oct 27 22:20:19 2000 +0000
@@ -1,3 +1,50 @@
+2000-10-27  Stefan Monnier  <monnier@cs.yale.edu>
+
+	* 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.
+
 2000-10-27  Jason Rumney  <jasonr@gnu.org>
 
 	* w32fns.c (Fx_create_frame): Make default fontsize on w32 10
--- a/src/doc.c	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/doc.c	Fri Oct 27 22:20:19 2000 +0000
@@ -737,8 +737,8 @@
 	      tem = Fsymbol_value (name);
 	      if (! NILP (tem))
 		{
-		  tem = get_keymap_1 (tem, 0, 1);
-		  /* Note that get_keymap_1 can GC.  */
+		  tem = get_keymap (tem, 0, 1);
+		  /* Note that get_keymap can GC.  */
 		  strp = XSTRING (string)->data + idx;
 		  start = XSTRING (string)->data + start_idx;
 		}
--- a/src/intervals.c	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/intervals.c	Fri Oct 27 22:20:19 2000 +0000
@@ -2208,11 +2208,8 @@
   BUF_ZV_BYTE (buffer) = old_zv_byte;
 
   /* Use the local map only if it is valid.  */
-  /* Do allow symbols that are defined as keymaps.  */
-  if (SYMBOLP (prop) && !NILP (prop))
-    prop = indirect_function (prop);
-  if (!NILP (prop)
-      && (tem = Fkeymapp (prop), !NILP (tem)))
+  prop = get_keymap (prop, 0, 0);
+  if (CONSP (prop))
     return prop;
 
   if (type == keymap)
--- 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;
--- a/src/keyboard.h	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/keyboard.h	Fri Oct 27 22:20:19 2000 +0000
@@ -291,8 +291,6 @@
 /* Forward declaration for prototypes.  */
 struct input_event;
 
-extern Lisp_Object get_keymap_1 P_ ((Lisp_Object, int, int));
-EXFUN (Fkeymapp, 1);
 extern Lisp_Object parse_modifiers P_ ((Lisp_Object));
 extern Lisp_Object reorder_modifiers P_ ((Lisp_Object));
 extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
--- a/src/keymap.c	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/keymap.c	Fri Oct 27 22:20:19 2000 +0000
@@ -33,7 +33,6 @@
 #include "intervals.h"
 
 #define min(a, b) ((a) < (b) ? (a) : (b))
-#define KEYMAPP(m) (!NILP (Fkeymapp (m)))
 
 /* The number of elements in keymap vectors.  */
 #define DENSE_TABLE_SIZE (0200)
@@ -190,8 +189,7 @@
   (object)
      Lisp_Object object;
 {
-  /* FIXME: Maybe this should return t for autoloaded keymaps?   -sm  */
-  return (NILP (get_keymap_1 (object, 0, 0)) ? Qnil : Qt);
+  return (KEYMAPP (object) ? Qt : Qnil);
 }
 
 /* Check that OBJECT is a keymap (after dereferencing through any
@@ -201,6 +199,9 @@
    is an autoload form, do the autoload and try again.
    If AUTOLOAD is nonzero, callers must assume GC is possible.
 
+   If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR
+   is zero as well), return Qt.
+
    ERROR controls how we respond if OBJECT isn't a keymap.
    If ERROR is non-zero, signal an error; otherwise, just return Qnil.
 
@@ -214,7 +215,7 @@
    do_autoload which can GC.  */
 
 Lisp_Object
-get_keymap_1 (object, error, autoload)
+get_keymap (object, error, autoload)
      Lisp_Object object;
      int error, autoload;
 {
@@ -225,32 +226,35 @@
     goto end;
   if (CONSP (object) && EQ (XCAR (object), Qkeymap))
     return object;
-  else
+
+  tem = indirect_function (object);
+  if (CONSP (tem))
     {
-      tem = indirect_function (object);
-      if (CONSP (tem) && EQ (XCAR (tem), Qkeymap))
+      if (EQ (XCAR (tem), Qkeymap))
 	return tem;
-    }
-
-  /* Should we do an autoload?  Autoload forms for keymaps have
-     Qkeymap as their fifth element.  */
-  if (autoload
-      && SYMBOLP (object)
-      && CONSP (tem)
-      && EQ (XCAR (tem), Qautoload))
-    {
-      Lisp_Object tail;
-
-      tail = Fnth (make_number (4), tem);
-      if (EQ (tail, Qkeymap))
+
+      /* Should we do an autoload?  Autoload forms for keymaps have
+	 Qkeymap as their fifth element.  */
+      if ((autoload || !error) && EQ (XCAR (tem), Qautoload))
 	{
-	  struct gcpro gcpro1, gcpro2;
-
-	  GCPRO2 (tem, object);
-	  do_autoload (tem, object);
-	  UNGCPRO;
-
-	  goto autoload_retry;
+	  Lisp_Object tail;
+
+	  tail = Fnth (make_number (4), tem);
+	  if (EQ (tail, Qkeymap))
+	    {
+	      if (autoload)
+		{
+		  struct gcpro gcpro1, gcpro2;
+		  
+		  GCPRO2 (tem, object);
+		  do_autoload (tem, object);
+		  UNGCPRO;
+		  
+		  goto autoload_retry;
+		}
+	      else
+	      	return Qt;
+	    }
 	}
     }
 
@@ -259,16 +263,6 @@
     wrong_type_argument (Qkeymapp, object);
   return Qnil;
 }
-
-
-/* Follow any symbol chaining, and return the keymap denoted by OBJECT.
-   If OBJECT doesn't denote a keymap at all, signal an error.  */
-Lisp_Object
-get_keymap (object)
-     Lisp_Object object;
-{
-  return get_keymap_1 (object, 1, 0);
-}
 
 /* Return the parent map of the keymap MAP, or nil if it has none.
    We assume that MAP is a valid keymap.  */
@@ -280,7 +274,7 @@
 {
   Lisp_Object list;
 
-  keymap = get_keymap_1 (keymap, 1, 1);
+  keymap = get_keymap (keymap, 1, 1);
 
   /* Skip past the initial element `keymap'.  */
   list = XCDR (keymap);
@@ -291,7 +285,7 @@
 	return list;
     }
 
-  return get_keymap_1(list, 0, 1);
+  return get_keymap (list, 0, 1);
 }
 
 
@@ -327,12 +321,12 @@
      This is a very minor correctness (rather than safety) issue.  */
   where_is_cache_keymaps = Qt;
 
-  keymap = get_keymap_1 (keymap, 1, 1);
+  keymap = get_keymap (keymap, 1, 1);
   GCPRO1 (keymap);
   
   if (!NILP (parent))
     {
-      parent = get_keymap_1 (parent, 1, 1);
+      parent = get_keymap (parent, 1, 1);
 
       /* Check for cycles.  */
       if (keymap_memberp (keymap, parent))
@@ -404,22 +398,22 @@
   /* SUBMAP is a cons that we found as a key binding.
      Discard the other things found in a menu key binding.  */
 
-  submap = get_keymap_1 (get_keyelt (submap, 0), 0, 0);
+  submap = get_keymap (get_keyelt (submap, 0), 0, 0);
 
   /* If it isn't a keymap now, there's no work to do.  */
-  if (NILP (submap))
+  if (!CONSP (submap))
     return;
 
   map_parent = Fkeymap_parent (map);
-  if (! NILP (map_parent))
+  if (!NILP (map_parent))
     parent_entry =
-      get_keymap_1 (access_keymap (map_parent, event, 0, 0, 0), 0, 0);
+      get_keymap (access_keymap (map_parent, event, 0, 0, 0), 0, 0);
   else
     parent_entry = Qnil;
 
   /* If MAP's parent has something other than a keymap,
      our own submap shadows it completely.  */
-  if (NILP (parent_entry))
+  if (!CONSP (parent_entry))
     return;
 
   if (! EQ (parent_entry, submap))
@@ -489,10 +483,10 @@
       /* See if there is a meta-map.  If there's none, there is
          no binding for IDX, unless a default binding exists in MAP.  */
       Lisp_Object meta_map =
-	get_keymap_1 (access_keymap (map, meta_prefix_char,
-				     t_ok, noinherit, autoload),
-		      0, autoload);
-      if (!NILP (meta_map))
+	get_keymap (access_keymap (map, meta_prefix_char,
+				   t_ok, noinherit, autoload),
+		    0, autoload);
+      if (CONSP (meta_map))
 	{
 	  map = meta_map;
 	  idx = make_number (XUINT (idx) & ~meta_modifier);
@@ -512,8 +506,7 @@
     t_binding = Qnil;
     for (tail = XCDR (map);
 	 (CONSP (tail)
-	  || (tail = get_keymap_1 (tail, 0, autoload),
-	      CONSP (tail)));
+	  || (tail = get_keymap (tail, 0, autoload), CONSP (tail)));
 	 tail = XCDR (tail))
       {
 	Lisp_Object binding;
@@ -666,8 +659,8 @@
       else
 	{
 	  Lisp_Object map;
-	  map = get_keymap_1 (Fcar_safe (object), 0, autoload);
-	  return (NILP (map) ? object /* Invalid keymap */
+	  map = get_keymap (Fcar_safe (object), 0, autoload);
+	  return (!CONSP (map) ? object /* Invalid keymap */
 		  : access_keymap (map, Fcdr (object), 0, 0, autoload));
 	}
     }
@@ -780,7 +773,7 @@
 copy_keymap_1 (chartable, idx, elt)
      Lisp_Object chartable, idx, elt;
 {
-  if (!SYMBOLP (elt) && ! NILP (Fkeymapp (elt)))
+  if (CONSP (elt) && EQ (XCAR (elt), Qkeymap))
     Faset (chartable, idx, Fcopy_keymap (elt));
 }
 
@@ -796,7 +789,7 @@
 {
   register Lisp_Object copy, tail;
 
-  copy = Fcopy_alist (get_keymap (keymap));
+  copy = Fcopy_alist (get_keymap (keymap, 1, 0));
 
   for (tail = copy; CONSP (tail); tail = XCDR (tail))
     {
@@ -820,8 +813,7 @@
 	  XCAR (tail) = elt;
 
 	  for (i = 0; i < ASIZE (elt); i++)
-	    if (!SYMBOLP (AREF (elt, i))
-		&& ! NILP (Fkeymapp (AREF (elt, i))))
+	    if (CONSP (AREF (elt, i)) && EQ (XCAR (AREF (elt, i)), Qkeymap))
 	      ASET (elt, i, Fcopy_keymap (AREF (elt, i)));
 	}
       else if (CONSP (elt) && CONSP (XCDR (elt)))
@@ -853,7 +845,7 @@
 		    = Fcons (XCAR (tem), XCDR (tem));
 		  elt = XCDR (elt);
 		  tem = XCAR (elt);
-		  if (!(SYMBOLP (tem) || NILP (Fkeymapp (tem))))
+		  if (CONSP (tem) && EQ (XCAR (tem), Qkeymap))
 		    XCAR (elt) = Fcopy_keymap (tem);
 		  tem = XCDR (elt);
 		  if (CONSP (tem) && CONSP (XCAR (tem)))
@@ -890,8 +882,8 @@
 		    XCDR (elt) = XCDR (tem);
 		}
 	      if (CONSP (elt)
-		  && ! SYMBOLP (XCDR (elt))
-		  && ! NILP (Fkeymapp (XCDR (elt))))
+		  && CONSP (XCDR (elt))
+		  && EQ (XCAR (XCDR (elt)), Qkeymap))
 		XCDR (elt) = Fcopy_keymap (XCDR (elt));
 	    }
 
@@ -938,7 +930,7 @@
   int length;
   struct gcpro gcpro1, gcpro2, gcpro3;
 
-  keymap = get_keymap_1 (keymap, 1, 1);
+  keymap = get_keymap (keymap, 1, 1);
 
   if (!VECTORP (key) && !STRINGP (key))
     key = wrong_type_argument (Qarrayp, key);
@@ -993,8 +985,8 @@
       if (NILP (cmd))
 	cmd = define_as_prefix (keymap, c);
 
-      keymap = get_keymap_1 (cmd, 0, 1);
-      if (NILP (keymap))
+      keymap = get_keymap (cmd, 0, 1);
+      if (!CONSP (keymap))
 	/* We must use Fkey_description rather than just passing key to
 	   error; key might be a vector, not a string.  */
 	error ("Key sequence %s uses invalid prefix characters",
@@ -1032,7 +1024,7 @@
   int t_ok = ! NILP (accept_default);
   struct gcpro gcpro1;
 
-  keymap = get_keymap_1 (keymap, 1, 1);
+  keymap = get_keymap (keymap, 1, 1);
 
   if (!VECTORP (key) && !STRINGP (key))
     key = wrong_type_argument (Qarrayp, key);
@@ -1059,8 +1051,8 @@
       if (idx == length)
 	RETURN_UNGCPRO (cmd);
 
-      keymap = get_keymap_1 (cmd, 0, 1);
-      if (NILP (keymap))
+      keymap = get_keymap (cmd, 0, 1);
+      if (!CONSP (keymap))
 	RETURN_UNGCPRO (make_number (idx));
 
       QUIT;
@@ -1362,11 +1354,11 @@
   GCPRO2 (key, binding);
 
   for (i = j = 0; i < nmaps; i++)
-    if (! NILP (maps[i])
-	&& ! NILP (binding = Flookup_key (maps[i], key, accept_default))
+    if (!NILP (maps[i])
+	&& !NILP (binding = Flookup_key (maps[i], key, accept_default))
 	&& !INTEGERP (binding))
       {
-	if (! NILP (get_keymap (binding)))
+	if (KEYMAPP (binding))
 	  maps[j++] = Fcons (modes[i], binding);
 	else if (j == 0)
 	  RETURN_UNGCPRO (Fcons (Fcons (modes[i], binding), Qnil));
@@ -1402,7 +1394,7 @@
   (keymap)
      Lisp_Object keymap;
 {
-  keymap = get_keymap (keymap);
+  keymap = get_keymap (keymap, 1, 1);
   current_global_map = keymap;
 
   return Qnil;
@@ -1415,7 +1407,7 @@
      Lisp_Object keymap;
 {
   if (!NILP (keymap))
-    keymap = get_keymap (keymap);
+    keymap = get_keymap (keymap, 1, 1);
 
   current_buffer->keymap = keymap;
 
@@ -1480,8 +1472,8 @@
       /* Flookup_key may give us nil, or a number,
 	 if the prefix is not defined in this particular map.
 	 It might even give us a list that isn't a keymap.  */
-      tem = get_keymap_1 (tem, 0, 0);
-      if (!NILP (tem))
+      tem = get_keymap (tem, 0, 0);
+      if (CONSP (tem))
 	{
 	  /* Convert PREFIX to a vector now, so that later on
 	     we don't have to deal with the possibility of a string.  */
@@ -1509,7 +1501,7 @@
     }
   else
     maps = Fcons (Fcons (Fmake_vector (make_number (0), Qnil),
-			 get_keymap (keymap)),
+			 get_keymap (keymap, 1, 0)),
 		  Qnil);
 
   /* For each map in the list maps,
@@ -1562,10 +1554,10 @@
 
 		  cmd = get_keyelt (AREF (elt, i), 0);
 		  if (NILP (cmd)) continue;
-		  tem = Fkeymapp (cmd);
-		  if (!NILP (tem))
+		  tem = get_keymap (cmd, 0, 0);
+		  if (CONSP (tem))
 		    {
-		      cmd = get_keymap (cmd);
+		      cmd = tem;
 		      /* Ignore keymaps that are already added to maps.  */
 		      tem = Frassq (cmd, maps);
 		      if (NILP (tem))
@@ -1603,11 +1595,11 @@
 
 	      cmd = get_keyelt (XCDR (elt), 0);
 	      /* Ignore definitions that aren't keymaps themselves.  */
-	      tem = Fkeymapp (cmd);
-	      if (!NILP (tem))
+	      tem = get_keymap (cmd, 0, 0);
+	      if (CONSP (tem))
 		{
 		  /* Ignore keymaps that have been seen already.  */
-		  cmd = get_keymap (cmd);
+		  cmd = tem;
 		  tem = Frassq (cmd, maps);
 		  if (NILP (tem))
 		    {
@@ -1687,10 +1679,10 @@
   tail = XCAR (XCDR (args));
   thisseq = XCDR (XCDR (args));
 
-  tem = Fkeymapp (cmd);
-  if (!NILP (tem))
+  tem = get_keymap (cmd, 0, 0);
+  if (CONSP (tem))
     {
-      cmd = get_keymap (cmd);
+      cmd = tem;
       /* Ignore keymaps that are already added to maps.  */
       tem = Frassq (cmd, maps);
       if (NILP (tem))
@@ -2087,7 +2079,8 @@
   while (CONSP (found))
     {
       maps =
-	nconc2 (maps, Faccessible_keymaps (get_keymap (XCAR (found)), Qnil));
+	nconc2 (maps,
+		Faccessible_keymaps (get_keymap (XCAR (found), 1, 0), Qnil));
       found = XCDR (found);
     }
  
@@ -2667,7 +2660,7 @@
 	  /* If shmap is not nil and not a keymap,
 	     it completely shadows this map, so don't
 	     describe this map at all.  */
-	  if (!NILP (shmap) && NILP (Fkeymapp (shmap)))
+	  if (!NILP (shmap) && !KEYMAPP (shmap))
 	    goto skip;
 
 	  if (!NILP (shmap))
@@ -2729,14 +2722,10 @@
     }
   else if (STRINGP (definition) || VECTORP (definition))
     insert_string ("Keyboard Macro\n");
+  else if (KEYMAPP (definition))
+    insert_string ("Prefix Command\n");
   else
-    {
-      tem1 = Fkeymapp (definition);
-      if (!NILP (tem1))
-	insert_string ("Prefix Command\n");
-      else
-	insert_string ("??\n");
-    }
+    insert_string ("??\n");
 }
 
 static void
@@ -2758,14 +2747,10 @@
       insert1 (Fkey_description (definition));
       insert_string ("\n");
     }
+  else if (KEYMAPP (definition))
+    insert_string ("Prefix Command\n");
   else
-    {
-      tem1 = Fkeymapp (definition);
-      if (!NILP (tem1))
-	insert_string ("Prefix Command\n");
-      else
-	insert_string ("??\n");
-    }
+    insert_string ("??\n");
 }
 
 /* Describe the contents of map MAP, assuming that this map itself is
--- a/src/lisp.h	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/lisp.h	Fri Oct 27 22:20:19 2000 +0000
@@ -2582,6 +2582,7 @@
 
 /* defined in keymap.c */
 
+#define KEYMAPP(m) (!NILP (get_keymap (m, 0, 0)))
 extern Lisp_Object Qkeymap, Qmenu_bar;
 extern Lisp_Object current_global_map;
 EXFUN (Fmake_sparse_keymap, 1);
@@ -2594,8 +2595,7 @@
 EXFUN (Fwhere_is_internal, 4);
 extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int));
 extern Lisp_Object get_keyelt P_ ((Lisp_Object, int));
-extern Lisp_Object get_keymap P_ ((Lisp_Object));
-extern Lisp_Object get_keymap_1 P_ ((Lisp_Object, int, int));
+extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int));
 extern void describe_vector P_ ((Lisp_Object, Lisp_Object,
 				 void (*) (Lisp_Object), int,
 				 Lisp_Object, Lisp_Object, int *, int));
--- a/src/minibuf.c	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/minibuf.c	Fri Oct 27 22:20:19 2000 +0000
@@ -817,7 +817,7 @@
   if (NILP (keymap))
     keymap = Vminibuffer_local_map;
   else
-    keymap = get_keymap (keymap);
+    keymap = get_keymap (keymap, 1, 0);
 
   if (SYMBOLP (hist))
     {
--- a/src/w32menu.c	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/w32menu.c	Fri Oct 27 22:20:19 2000 +0000
@@ -53,9 +53,6 @@
 typedef void * XtPointer;
 typedef char Boolean;
 
-#define True 1
-#define False 0
-
 enum button_type
 {
   BUTTON_TYPE_NONE,
@@ -722,15 +719,11 @@
 
   /* Decode the menu items from what was specified.  */
 
-  keymap = Fkeymapp (menu);
-  tem = Qnil;
-  if (CONSP (menu))
-    tem = Fkeymapp (Fcar (menu));
-  if (!NILP (keymap))
+  keymap = get_keymap (menu, 0, 0);
+  if (CONSP (keymap))
     {
       /* We were given a keymap.  Extract menu info from the keymap.  */
       Lisp_Object prompt;
-      keymap = get_keymap (menu);
 
       /* Extract the detailed info to make one pane.  */
       keymap_panes (&menu, 1, NILP (position));
@@ -747,7 +740,7 @@
 
       keymaps = 1;
     }
-  else if (!NILP (tem))
+  else if (CONSP (menu) && KEYMAPP (XCAR (menu)))
     {
       /* We were given a list of keymaps.  */
       int nmaps = XFASTINT (Flength (menu));
@@ -763,7 +756,7 @@
 	{
 	  Lisp_Object prompt;
 
-	  maps[i++] = keymap = get_keymap (Fcar (tem));
+	  maps[i++] = keymap = get_keymap (Fcar (tem), 1, 0);
 
 	  prompt = map_prompt (keymap);
 	  if (NILP (title) && !NILP (prompt))
@@ -1117,8 +1110,7 @@
   for (i = 0; i < len; i++)
     {
       if (SYMBOLP (mapvec[i])
-	  || (CONSP (mapvec[i])
-	      && NILP (Fkeymapp (mapvec[i]))))
+	  || (CONSP (mapvec[i]) && !KEYMAPP (mapvec[i])))
 	{
 	  /* Here we have a command at top level in the menu bar
 	     as opposed to a submenu.  */
@@ -1734,8 +1726,8 @@
 	title = ENCODE_SYSTEM (title);
 #endif
       wv_title->name = (char *) XSTRING (title)->data;
-      wv_title->enabled = True;
-      wv_title->title = True;
+      wv_title->enabled = TRUE;
+      wv_title->title = TRUE;
       wv_title->button_type = BUTTON_TYPE_NONE;
       wv_title->next = wv_sep;
       first_wv->contents = wv_title;
@@ -1954,7 +1946,7 @@
   menu = lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv,
 			   f->output_data.w32->widget, 1, 0,
 			   dialog_selection_callback, 0);
-  lw_modify_all_widgets (dialog_id, first_wv->contents, True);
+  lw_modify_all_widgets (dialog_id, first_wv->contents, TRUE);
 #endif
 
   /* Free the widget_value objects we used to specify the contents.  */
--- a/src/w32term.c	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/w32term.c	Fri Oct 27 22:20:19 2000 +0000
@@ -5931,7 +5931,7 @@
 	  /* Change the mouse pointer according to what is under X/Y.  */
 	  map = Fget_text_property (make_number (glyph->charpos),
 				    Qlocal_map, glyph->object);
-	  if (!NILP (Fkeymapp (map)))
+	  if (KEYMAPP (map))
 	    cursor = f->output_data.w32->nontext_cursor;
 	}
     }
--- a/src/xmenu.c	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/xmenu.c	Fri Oct 27 22:20:19 2000 +0000
@@ -38,9 +38,9 @@
 #include <stdio.h>
 #include "lisp.h"
 #include "termhooks.h"
+#include "keyboard.h"
 #include "frame.h"
 #include "window.h"
-#include "keyboard.h"
 #include "blockinput.h"
 #include "buffer.h"
 
@@ -788,15 +788,11 @@
 
   /* Decode the menu items from what was specified.  */
 
-  keymap = Fkeymapp (menu);
-  tem = Qnil;
-  if (CONSP (menu))
-    tem = Fkeymapp (Fcar (menu));
-  if (!NILP (keymap))
+  keymap = get_keymap (menu, 0, 0);
+  if (CONSP (keymap))
     {
       /* We were given a keymap.  Extract menu info from the keymap.  */
       Lisp_Object prompt;
-      keymap = get_keymap (menu);
 
       /* Extract the detailed info to make one pane.  */
       keymap_panes (&menu, 1, NILP (position));
@@ -813,7 +809,7 @@
 
       keymaps = 1;
     }
-  else if (!NILP (tem))
+  else if (CONSP (menu) && KEYMAPP (XCAR (menu)))
     {
       /* We were given a list of keymaps.  */
       int nmaps = XFASTINT (Flength (menu));
@@ -829,7 +825,7 @@
 	{
 	  Lisp_Object prompt;
 
-	  maps[i++] = keymap = get_keymap (Fcar (tem));
+	  maps[i++] = keymap = get_keymap (Fcar (tem), 1, 0);
 
 	  prompt = map_prompt (keymap);
 	  if (NILP (title) && !NILP (prompt))
@@ -1396,8 +1392,7 @@
   for (i = 0; i < len; i++)
     {
       if (SYMBOLP (mapvec[i])
-	  || (CONSP (mapvec[i])
-	      && NILP (Fkeymapp (mapvec[i]))))
+	  || (CONSP (mapvec[i]) && !KEYMAPP (mapvec[i])))
 	{
 	  /* Here we have a command at top level in the menu bar
 	     as opposed to a submenu.  */
--- a/src/xterm.c	Fri Oct 27 22:05:48 2000 +0000
+++ b/src/xterm.c	Fri Oct 27 22:20:19 2000 +0000
@@ -6502,13 +6502,13 @@
 	  /* Change the mouse pointer according to what is under X/Y.  */
 	  map = Fget_text_property (make_number (glyph->charpos),
 				    Qlocal_map, glyph->object);
-	  if (!NILP (Fkeymapp (map)))
+	  if (KEYMAPP (map))
 	    cursor = f->output_data.x->nontext_cursor;
 	  else
 	    {
 	      map = Fget_text_property (make_number (glyph->charpos),
 					Qkeymap, glyph->object);
-	      if (!NILP (Fkeymapp (map)))
+	      if (KEYMAPP (map))
 		cursor = f->output_data.x->nontext_cursor;
 	    }
 	}