Commit 02067692 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* 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.
parent b01c997e
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> 2000-10-27 Jason Rumney <jasonr@gnu.org>
* w32fns.c (Fx_create_frame): Make default fontsize on w32 10 * w32fns.c (Fx_create_frame): Make default fontsize on w32 10
......
...@@ -737,8 +737,8 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int ...@@ -737,8 +737,8 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
tem = Fsymbol_value (name); tem = Fsymbol_value (name);
if (! NILP (tem)) if (! NILP (tem))
{ {
tem = get_keymap_1 (tem, 0, 1); tem = get_keymap (tem, 0, 1);
/* Note that get_keymap_1 can GC. */ /* Note that get_keymap can GC. */
strp = XSTRING (string)->data + idx; strp = XSTRING (string)->data + idx;
start = XSTRING (string)->data + start_idx; start = XSTRING (string)->data + start_idx;
} }
......
...@@ -2208,11 +2208,8 @@ get_local_map (position, buffer, type) ...@@ -2208,11 +2208,8 @@ get_local_map (position, buffer, type)
BUF_ZV_BYTE (buffer) = old_zv_byte; BUF_ZV_BYTE (buffer) = old_zv_byte;
/* Use the local map only if it is valid. */ /* Use the local map only if it is valid. */
/* Do allow symbols that are defined as keymaps. */ prop = get_keymap (prop, 0, 0);
if (SYMBOLP (prop) && !NILP (prop)) if (CONSP (prop))
prop = indirect_function (prop);
if (!NILP (prop)
&& (tem = Fkeymapp (prop), !NILP (tem)))
return prop; return prop;
if (type == keymap) if (type == keymap)
......
...@@ -2574,7 +2574,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) ...@@ -2574,7 +2574,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
and loop around to read another event. */ and loop around to read another event. */
save = Vquit_flag; save = Vquit_flag;
Vquit_flag = Qnil; 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; Vquit_flag = save;
if (!NILP (tem)) if (!NILP (tem))
...@@ -6259,9 +6259,9 @@ menu_bar_items (old) ...@@ -6259,9 +6259,9 @@ menu_bar_items (old)
for (mapno = nmaps - 1; mapno >= 0; mapno--) for (mapno = nmaps - 1; mapno >= 0; mapno--)
if (!NILP (maps[mapno])) if (!NILP (maps[mapno]))
{ {
def = access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0); def = get_keymap (access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0),
tem = Fkeymapp (def); 0, 0);
if (!NILP (tem)) if (CONSP (def))
menu_bar_one_keymap (def); menu_bar_one_keymap (def);
} }
...@@ -6327,11 +6327,6 @@ menu_bar_one_keymap (keymap) ...@@ -6327,11 +6327,6 @@ menu_bar_one_keymap (keymap)
{ {
Lisp_Object tail, item; 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; menu_bar_one_keymap_changed_items = Qnil;
/* Loop over all keymap entries that have menu strings. */ /* Loop over all keymap entries that have menu strings. */
...@@ -6661,9 +6656,9 @@ parse_menu_item (item, notreal, inmenubar) ...@@ -6661,9 +6656,9 @@ parse_menu_item (item, notreal, inmenubar)
/* See if this is a separate pane or a submenu. */ /* See if this is a separate pane or a submenu. */
def = AREF (item_properties, ITEM_PROPERTY_DEF); 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. */ /* 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_MAP) = tem;
AREF (item_properties, ITEM_PROPERTY_DEF) = tem; AREF (item_properties, ITEM_PROPERTY_DEF) = tem;
...@@ -6918,16 +6913,11 @@ tool_bar_items (reuse, nitems) ...@@ -6918,16 +6913,11 @@ tool_bar_items (reuse, nitems)
Lisp_Object keymap; Lisp_Object keymap;
/* Why set the `noinherit' flag ? -sm */ /* Why set the `noinherit' flag ? -sm */
keymap = access_keymap (maps[i], Qtool_bar, 1, 1, 0); keymap = get_keymap (access_keymap (maps[i], Qtool_bar, 1, 1, 0), 0, 0);
if (!NILP (Fkeymapp (keymap))) if (CONSP (keymap))
{ {
Lisp_Object tail; 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) ...)'. */ /* KEYMAP is a list `(keymap (KEY . BINDING) ...)'. */
for (tail = keymap; CONSP (tail); tail = XCDR (tail)) for (tail = keymap; CONSP (tail); tail = XCDR (tail))
{ {
...@@ -7144,7 +7134,7 @@ parse_tool_bar_item (key, item) ...@@ -7144,7 +7134,7 @@ parse_tool_bar_item (key, item)
PROP (TOOL_BAR_ITEM_BINDING)))); PROP (TOOL_BAR_ITEM_BINDING))));
/* See if the binding is a keymap. Give up if it is. */ /* 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; return 0;
/* Enable or disable selection of item. */ /* Enable or disable selection of item. */
...@@ -7627,7 +7617,7 @@ follow_key (key, nmaps, current, defs, next) ...@@ -7627,7 +7617,7 @@ follow_key (key, nmaps, current, defs, next)
/* Given the set of bindings we've found, produce the next set of maps. */ /* Given the set of bindings we've found, produce the next set of maps. */
if (first_binding < nmaps) if (first_binding < nmaps)
for (i = 0; i < nmaps; i++) 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; return first_binding;
} }
...@@ -7793,11 +7783,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, ...@@ -7793,11 +7783,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
keytran_map = Vkey_translation_map; keytran_map = Vkey_translation_map;
/* If there is no function-key-map, turn off function key scanning. */ /* 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; fkey_start = fkey_end = bufsize + 1;
/* If there is no key-translation-map, turn off scanning. */ /* 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; keytran_start = keytran_end = bufsize + 1;
if (INTERACTIVE) if (INTERACTIVE)
...@@ -8452,7 +8442,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, ...@@ -8452,7 +8442,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
or an array. */ or an array. */
if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next)) if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next))
&& (!NILP (Farrayp (XSYMBOL (fkey_next)->function)) && (!NILP (Farrayp (XSYMBOL (fkey_next)->function))
|| !NILP (Fkeymapp (XSYMBOL (fkey_next)->function)))) || KEYMAPP (XSYMBOL (fkey_next)->function)))
fkey_next = XSYMBOL (fkey_next)->function; fkey_next = XSYMBOL (fkey_next)->function;
#if 0 /* I didn't turn this on, because it might cause trouble #if 0 /* I didn't turn this on, because it might cause trouble
...@@ -8525,11 +8515,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, ...@@ -8525,11 +8515,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
goto replay_sequence; 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 /* If we no longer have a bound suffix, try a new positions for
fkey_start. */ fkey_start. */
if (NILP (fkey_map)) if (!CONSP (fkey_map))
{ {
fkey_end = ++fkey_start; fkey_end = ++fkey_start;
fkey_map = Vfunction_key_map; fkey_map = Vfunction_key_map;
...@@ -8562,7 +8552,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, ...@@ -8562,7 +8552,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
or an array. */ or an array. */
if (SYMBOLP (keytran_next) && ! NILP (Ffboundp (keytran_next)) if (SYMBOLP (keytran_next) && ! NILP (Ffboundp (keytran_next))
&& (!NILP (Farrayp (XSYMBOL (keytran_next)->function)) && (!NILP (Farrayp (XSYMBOL (keytran_next)->function))
|| !NILP (Fkeymapp (XSYMBOL (keytran_next)->function)))) || KEYMAPP (XSYMBOL (keytran_next)->function)))
keytran_next = XSYMBOL (keytran_next)->function; keytran_next = XSYMBOL (keytran_next)->function;
/* If the key translation map gives a function, not an /* If the key translation map gives a function, not an
...@@ -8626,11 +8616,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, ...@@ -8626,11 +8616,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
goto replay_sequence; 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 /* If we no longer have a bound suffix, try a new positions for
keytran_start. */ keytran_start. */
if (NILP (keytran_map)) if (!CONSP (keytran_map))
{ {
keytran_end = ++keytran_start; keytran_end = ++keytran_start;
keytran_map = Vkey_translation_map; keytran_map = Vkey_translation_map;
......
...@@ -291,8 +291,6 @@ extern Lisp_Object Qmode_line, Qvertical_line, Qheader_line; ...@@ -291,8 +291,6 @@ extern Lisp_Object Qmode_line, Qvertical_line, Qheader_line;
/* Forward declaration for prototypes. */ /* Forward declaration for prototypes. */
struct input_event; 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 parse_modifiers P_ ((Lisp_Object));
extern Lisp_Object reorder_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 *)); extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
......
...@@ -33,7 +33,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -33,7 +33,6 @@ Boston, MA 02111-1307, USA. */
#include "intervals.h" #include "intervals.h"
#define min(a, b) ((a) < (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b))
#define KEYMAPP(m) (!NILP (Fkeymapp (m)))
/* The number of elements in keymap vectors. */ /* The number of elements in keymap vectors. */
#define DENSE_TABLE_SIZE (0200) #define DENSE_TABLE_SIZE (0200)
...@@ -190,8 +189,7 @@ is also allowed as an element.") ...@@ -190,8 +189,7 @@ is also allowed as an element.")
(object) (object)
Lisp_Object object; Lisp_Object object;
{ {
/* FIXME: Maybe this should return t for autoloaded keymaps? -sm */ return (KEYMAPP (object) ? Qt : Qnil);
return (NILP (get_keymap_1 (object, 0, 0)) ? Qnil : Qt);
} }
/* Check that OBJECT is a keymap (after dereferencing through any /* Check that OBJECT is a keymap (after dereferencing through any
...@@ -201,6 +199,9 @@ is also allowed as an element.") ...@@ -201,6 +199,9 @@ is also allowed as an element.")
is an autoload form, do the autoload and try again. is an autoload form, do the autoload and try again.
If AUTOLOAD is nonzero, callers must assume GC is possible. 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. ERROR controls how we respond if OBJECT isn't a keymap.
If ERROR is non-zero, signal an error; otherwise, just return Qnil. If ERROR is non-zero, signal an error; otherwise, just return Qnil.
...@@ -214,7 +215,7 @@ is also allowed as an element.") ...@@ -214,7 +215,7 @@ is also allowed as an element.")
do_autoload which can GC. */ do_autoload which can GC. */
Lisp_Object Lisp_Object
get_keymap_1 (object, error, autoload) get_keymap (object, error, autoload)
Lisp_Object object; Lisp_Object object;
int error, autoload; int error, autoload;
{ {
...@@ -225,32 +226,35 @@ get_keymap_1 (object, error, autoload) ...@@ -225,32 +226,35 @@ get_keymap_1 (object, error, autoload)
goto end; goto end;
if (CONSP (object) && EQ (XCAR (object), Qkeymap)) if (CONSP (object) && EQ (XCAR (object), Qkeymap))
return object; return object;
else
{
tem = indirect_function (object);
if (CONSP (tem) && EQ (XCAR (tem), Qkeymap))
return tem;
}
/* Should we do an autoload? Autoload forms for keymaps have tem = indirect_function (object);
Qkeymap as their fifth element. */ if (CONSP (tem))
if (autoload
&& SYMBOLP (object)
&& CONSP (tem)
&& EQ (XCAR (tem), Qautoload))
{ {
Lisp_Object tail; if (EQ (XCAR (tem), Qkeymap))
return tem;
tail = Fnth (make_number (4), tem); /* Should we do an autoload? Autoload forms for keymaps have
if (EQ (tail, Qkeymap)) Qkeymap as their fifth element. */
if ((autoload || !error) && EQ (XCAR (tem), Qautoload))
{ {
struct gcpro gcpro1, gcpro2; Lisp_Object tail;
GCPRO2 (tem, object);
do_autoload (tem, object);
UNGCPRO;
goto autoload_retry; 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 @@ get_keymap_1 (object, error, autoload) ...@@ -259,16 +263,6 @@ get_keymap_1 (object, error, autoload)
wrong_type_argument (Qkeymapp, object); wrong_type_argument (Qkeymapp, object);
return Qnil; 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. /* Return the parent map of the keymap MAP, or nil if it has none.
We assume that MAP is a valid keymap. */ We assume that MAP is a valid keymap. */
...@@ -280,7 +274,7 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0, ...@@ -280,7 +274,7 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,
{ {
Lisp_Object list; Lisp_Object list;
keymap = get_keymap_1 (keymap, 1, 1); keymap = get_keymap (keymap, 1, 1);
/* Skip past the initial element `keymap'. */ /* Skip past the initial element `keymap'. */
list = XCDR (keymap); list = XCDR (keymap);
...@@ -291,7 +285,7 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0, ...@@ -291,7 +285,7 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,
return list; return list;
} }
return get_keymap_1(list, 0, 1); return get_keymap (list, 0, 1);
} }
...@@ -327,12 +321,12 @@ PARENT should be nil or another keymap.") ...@@ -327,12 +321,12 @@ PARENT should be nil or another keymap.")
This is a very minor correctness (rather than safety) issue. */ This is a very minor correctness (rather than safety) issue. */
where_is_cache_keymaps = Qt; where_is_cache_keymaps = Qt;
keymap = get_keymap_1 (keymap, 1, 1); keymap = get_keymap (keymap, 1, 1);
GCPRO1 (keymap); GCPRO1 (keymap);
if (!NILP (parent)) if (!NILP (parent))
{ {
parent = get_keymap_1 (parent, 1, 1); parent = get_keymap (parent, 1, 1);
/* Check for cycles. */ /* Check for cycles. */
if (keymap_memberp (keymap, parent)) if (keymap_memberp (keymap, parent))
...@@ -404,22 +398,22 @@ fix_submap_inheritance (map, event, submap) ...@@ -404,22 +398,22 @@ fix_submap_inheritance (map, event, submap)
/* SUBMAP is a cons that we found as a key binding. /* SUBMAP is a cons that we found as a key binding.
Discard the other things found in a menu 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 it isn't a keymap now, there's no work to do. */
if (NILP (submap)) if (!CONSP (submap))
return; return;
map_parent = Fkeymap_parent (map); map_parent = Fkeymap_parent (map);
if (! NILP (map_parent)) if (!NILP (map_parent))
parent_entry = 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 else
parent_entry = Qnil; parent_entry = Qnil;
/* If MAP's parent has something other than a keymap, /* If MAP's parent has something other than a keymap,
our own submap shadows it completely. */ our own submap shadows it completely. */
if (NILP (parent_entry)) if (!CONSP (parent_entry))
return; return;
if (! EQ (parent_entry, submap)) if (! EQ (parent_entry, submap))
...@@ -489,10 +483,10 @@ access_keymap (map, idx, t_ok, noinherit, autoload) ...@@ -489,10 +483,10 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
/* See if there is a meta-map. If there's none, there is /* See if there is a meta-map. If there's none, there is
no binding for IDX, unless a default binding exists in MAP. */ no binding for IDX, unless a default binding exists in MAP. */
Lisp_Object meta_map = Lisp_Object meta_map =
get_keymap_1 (access_keymap (map, meta_prefix_char, get_keymap (access_keymap (map, meta_prefix_char,
t_ok, noinherit, autoload), t_ok, noinherit, autoload),
0, autoload); 0, autoload);
if (!NILP (meta_map)) if (CONSP (meta_map))
{ {
map = meta_map; map = meta_map;
idx = make_number (XUINT (idx) & ~meta_modifier); idx = make_number (XUINT (idx) & ~meta_modifier);
...@@ -512,8 +506,7 @@ access_keymap (map, idx, t_ok, noinherit, autoload) ...@@ -512,8 +506,7 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
t_binding = Qnil; t_binding = Qnil;
for (tail = XCDR (map); for (tail = XCDR (map);
(CONSP (tail) (CONSP (tail)
|| (tail = get_keymap_1 (tail, 0, autoload), || (tail = get_keymap (tail, 0, autoload), CONSP (tail)));
CONSP (tail)));
tail = XCDR (tail)) tail = XCDR (tail))
{ {
Lisp_Object binding; Lisp_Object binding;
...@@ -666,8 +659,8 @@ get_keyelt (object, autoload) ...@@ -666,8 +659,8 @@ get_keyelt (object, autoload)
else else
{ {
Lisp_Object map; Lisp_Object map;
map = get_keymap_1 (Fcar_safe (object), 0, autoload); map = get_keymap (Fcar_safe (object), 0, autoload);
return (NILP (map) ? object /* Invalid keymap */ return (!CONSP (map) ? object /* Invalid keymap */
: access_keymap (map, Fcdr (object), 0, 0, autoload)); : access_keymap (map, Fcdr (object), 0, 0, autoload));
} }
} }
...@@ -780,7 +773,7 @@ void ...@@ -780,7 +773,7 @@ void
copy_keymap_1 (chartable, idx, elt) copy_keymap_1 (chartable, idx, elt)
Lisp_Object 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)); Faset (chartable, idx, Fcopy_keymap (elt));
} }
...@@ -796,7 +789,7 @@ is not copied.") ...@@ -796,7 +789,7 @@ is not copied.")
{ {
register Lisp_Object copy, tail; 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)) for (tail = copy; CONSP (tail); tail = XCDR (tail))
{ {
...@@ -820,8 +813,7 @@ is not copied.") ...@@ -820,8 +813,7 @@ is not copied.")
XCAR (tail) = elt; XCAR (tail) = elt;
for (i = 0; i < ASIZE (elt); i++) for (i = 0; i < ASIZE (elt); i++)
if (!SYMBOLP (AREF (elt, i)) if (CONSP (AREF (elt, i)) && EQ (XCAR (AREF (elt, i)), Qkeymap))
&& ! NILP (Fkeymapp (AREF (elt, i))))
ASET (elt, i, Fcopy_keymap (AREF (elt, i))); ASET (elt, i, Fcopy_keymap (AREF (elt, i)));
} }
else if (CONSP (elt) && CONSP (XCDR (elt))) else if (CONSP (elt) && CONSP (XCDR (elt)))
...@@ -853,7 +845,7 @@ is not copied.") ...@@ -853,7 +845,7 @@ is not copied.")
= Fcons (XCAR (tem), XCDR (tem)); = Fcons (XCAR (tem), XCDR (tem));
elt = XCDR (elt); elt = XCDR (elt);
tem = XCAR (elt); tem = XCAR (elt);
if (!(SYMBOLP (tem) || NILP (Fkeymapp (tem)))) if (CONSP (tem) && EQ (XCAR (tem), Qkeymap))
XCAR (elt) = Fcopy_keymap (tem); XCAR (elt) = Fcopy_keymap (tem);
tem = XCDR (elt); tem = XCDR (elt);
if (CONSP (tem) && CONSP (XCAR (tem))) if (CONSP (tem) && CONSP (XCAR (tem)))
...@@ -890,8 +882,8 @@ is not copied.") ...@@ -890,8 +882,8 @@ is not copied.")
XCDR (elt) = XCDR (tem); XCDR (elt) = XCDR (tem);
} }
if (CONSP (elt) if (CONSP (elt)