aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2000-10-27 22:20:19 +0000
committerStefan Monnier2000-10-27 22:20:19 +0000
commit020676925cfa3fee6a016bcbee89635dc647036f (patch)
treea4e3a50558adeba85798f52dd015cd24c076aa3e
parentb01c997e2b7319b27bf1a57c65bc484178f6772e (diff)
downloademacs-020676925cfa3fee6a016bcbee89635dc647036f.tar.gz
emacs-020676925cfa3fee6a016bcbee89635dc647036f.zip
* 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.
-rw-r--r--src/ChangeLog47
-rw-r--r--src/doc.c4
-rw-r--r--src/intervals.c7
-rw-r--r--src/keyboard.c46
-rw-r--r--src/keyboard.h2
-rw-r--r--src/keymap.c181
-rw-r--r--src/lisp.h4
-rw-r--r--src/minibuf.c2
-rw-r--r--src/w32menu.c24
-rw-r--r--src/w32term.c2
-rw-r--r--src/xmenu.c17
-rw-r--r--src/xterm.c4
12 files changed, 172 insertions, 168 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 69db7f0b200..e434301cb17 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,50 @@
12000-10-27 Stefan Monnier <monnier@cs.yale.edu>
2
3 * lisp.h (KEYMAPP): New macro.
4 (get_keymap): Remove.
5 (get_keymap_1): Rename get_keymap.
6
7 * keyboard.h (get_keymap_1, Fkeymapp): Remove prototype.
8
9 * xterm.c (note_mode_line_highlight): Use KEYMAPP.
10
11 * xmenu.c (single_submenu): Use KEYMAPP.
12 (Fx_popup_menu): Fetch keymaps rather than checking Fkeymapp.
13 Use KEYMAPP rather than Fkeymapp.
14
15 * w32term.c (note_mode_line_highlight): Use KEYMAPP.
16
17 * w32menu.c (True, False): Remove (use TRUE and FALSE instead).
18 (Fx_popup_menu): Fetch keymaps rather than checking Fkeymapp.
19 Use KEYMAPP rather than Fkeymapp.
20 (single_submenu): Use KEYMAPP.
21 (w32_menu_show, w32_dialog_show): Use TRUE.
22
23 * minibuf.c (Fread_from_minibuffer): Update call to get_keymap.
24
25 * keymap.c (KEYMAPP): Remove (moved to lisp.h).
26 (Fkeymapp): Use KEYMAPP.
27 (get_keymap): Rename from get_keymap_1. Remove old def.
28 Return t when autoload=0 and error=0 and the keymap needs autoloading.
29 (Fcopy_keymap): Check (eq (car x) 'keymap) rather than using Fkeymapp.
30 (Fminor_mode_key_binding): Don't raise an error if the binding
31 is not a keymap.
32 (Fuse_global_map, Fuse_local_map): Allow autoloading.
33 (Faccessible_keymaps): Fetch keymaps rather than checking Fkeymapp.
34
35 * keyboard.c (read_char): get_keymap_1 -> get_keymap.
36 Allow Vspecial_event_map to be autoloaded.
37 (menu_bar_items): Fetch the keymap rather than using keymapp.
38 (menu_bar_one_keymap): No need to follow func-indirect any more.
39 (parse_menu_item): get_keymap_1 -> get_keymap.
40 (tool_bar_items): Fetch the keymap rather than using keymapp.
41 (read_key_sequence): Use KEYMAPP.
42
43 * intervals.c (get_local_map): Use get_keymap rather than following
44 function-indirections explicitly.
45
46 * doc.c (Fsubstitute_command_keys): get_keymap_1 -> get_keymap.
47
12000-10-27 Jason Rumney <jasonr@gnu.org> 482000-10-27 Jason Rumney <jasonr@gnu.org>
2 49
3 * w32fns.c (Fx_create_frame): Make default fontsize on w32 10 50 * w32fns.c (Fx_create_frame): Make default fontsize on w32 10
diff --git a/src/doc.c b/src/doc.c
index ee0a28d1621..afa7e9df947 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -737,8 +737,8 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
737 tem = Fsymbol_value (name); 737 tem = Fsymbol_value (name);
738 if (! NILP (tem)) 738 if (! NILP (tem))
739 { 739 {
740 tem = get_keymap_1 (tem, 0, 1); 740 tem = get_keymap (tem, 0, 1);
741 /* Note that get_keymap_1 can GC. */ 741 /* Note that get_keymap can GC. */
742 strp = XSTRING (string)->data + idx; 742 strp = XSTRING (string)->data + idx;
743 start = XSTRING (string)->data + start_idx; 743 start = XSTRING (string)->data + start_idx;
744 } 744 }
diff --git a/src/intervals.c b/src/intervals.c
index 2b1b08219d4..1bacd104457 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -2208,11 +2208,8 @@ get_local_map (position, buffer, type)
2208 BUF_ZV_BYTE (buffer) = old_zv_byte; 2208 BUF_ZV_BYTE (buffer) = old_zv_byte;
2209 2209
2210 /* Use the local map only if it is valid. */ 2210 /* Use the local map only if it is valid. */
2211 /* Do allow symbols that are defined as keymaps. */ 2211 prop = get_keymap (prop, 0, 0);
2212 if (SYMBOLP (prop) && !NILP (prop)) 2212 if (CONSP (prop))
2213 prop = indirect_function (prop);
2214 if (!NILP (prop)
2215 && (tem = Fkeymapp (prop), !NILP (tem)))
2216 return prop; 2213 return prop;
2217 2214
2218 if (type == keymap) 2215 if (type == keymap)
diff --git a/src/keyboard.c b/src/keyboard.c
index 4e08cc5c3d6..380c5646a83 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2574,7 +2574,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2574 and loop around to read another event. */ 2574 and loop around to read another event. */
2575 save = Vquit_flag; 2575 save = Vquit_flag;
2576 Vquit_flag = Qnil; 2576 Vquit_flag = Qnil;
2577 tem = access_keymap (get_keymap_1 (Vspecial_event_map, 0, 0), c, 0, 0, 1); 2577 tem = access_keymap (get_keymap (Vspecial_event_map, 0, 1), c, 0, 0, 1);
2578 Vquit_flag = save; 2578 Vquit_flag = save;
2579 2579
2580 if (!NILP (tem)) 2580 if (!NILP (tem))
@@ -6259,9 +6259,9 @@ menu_bar_items (old)
6259 for (mapno = nmaps - 1; mapno >= 0; mapno--) 6259 for (mapno = nmaps - 1; mapno >= 0; mapno--)
6260 if (!NILP (maps[mapno])) 6260 if (!NILP (maps[mapno]))
6261 { 6261 {
6262 def = access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0); 6262 def = get_keymap (access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0),
6263 tem = Fkeymapp (def); 6263 0, 0);
6264 if (!NILP (tem)) 6264 if (CONSP (def))
6265 menu_bar_one_keymap (def); 6265 menu_bar_one_keymap (def);
6266 } 6266 }
6267 6267
@@ -6327,11 +6327,6 @@ menu_bar_one_keymap (keymap)
6327{ 6327{
6328 Lisp_Object tail, item; 6328 Lisp_Object tail, item;
6329 6329
6330 /* If KEYMAP is a symbol, its function definition is the keymap
6331 to use. */
6332 if (SYMBOLP (keymap))
6333 keymap = indirect_function (keymap);
6334
6335 menu_bar_one_keymap_changed_items = Qnil; 6330 menu_bar_one_keymap_changed_items = Qnil;
6336 6331
6337 /* Loop over all keymap entries that have menu strings. */ 6332 /* Loop over all keymap entries that have menu strings. */
@@ -6661,9 +6656,9 @@ parse_menu_item (item, notreal, inmenubar)
6661 6656
6662 /* See if this is a separate pane or a submenu. */ 6657 /* See if this is a separate pane or a submenu. */
6663 def = AREF (item_properties, ITEM_PROPERTY_DEF); 6658 def = AREF (item_properties, ITEM_PROPERTY_DEF);
6664 tem = get_keymap_1 (def, 0, 1); 6659 tem = get_keymap (def, 0, 1);
6665 /* For a subkeymap, just record its details and exit. */ 6660 /* For a subkeymap, just record its details and exit. */
6666 if (!NILP (tem)) 6661 if (CONSP (tem))
6667 { 6662 {
6668 AREF (item_properties, ITEM_PROPERTY_MAP) = tem; 6663 AREF (item_properties, ITEM_PROPERTY_MAP) = tem;
6669 AREF (item_properties, ITEM_PROPERTY_DEF) = tem; 6664 AREF (item_properties, ITEM_PROPERTY_DEF) = tem;
@@ -6918,16 +6913,11 @@ tool_bar_items (reuse, nitems)
6918 Lisp_Object keymap; 6913 Lisp_Object keymap;
6919 6914
6920 /* Why set the `noinherit' flag ? -sm */ 6915 /* Why set the `noinherit' flag ? -sm */
6921 keymap = access_keymap (maps[i], Qtool_bar, 1, 1, 0); 6916 keymap = get_keymap (access_keymap (maps[i], Qtool_bar, 1, 1, 0), 0, 0);
6922 if (!NILP (Fkeymapp (keymap))) 6917 if (CONSP (keymap))
6923 { 6918 {
6924 Lisp_Object tail; 6919 Lisp_Object tail;
6925 6920
6926 /* If KEYMAP is a symbol, its function definition is the
6927 keymap to use. */
6928 if (SYMBOLP (keymap))
6929 keymap = indirect_function (keymap);
6930
6931 /* KEYMAP is a list `(keymap (KEY . BINDING) ...)'. */ 6921 /* KEYMAP is a list `(keymap (KEY . BINDING) ...)'. */
6932 for (tail = keymap; CONSP (tail); tail = XCDR (tail)) 6922 for (tail = keymap; CONSP (tail); tail = XCDR (tail))
6933 { 6923 {
@@ -7144,7 +7134,7 @@ parse_tool_bar_item (key, item)
7144 PROP (TOOL_BAR_ITEM_BINDING)))); 7134 PROP (TOOL_BAR_ITEM_BINDING))));
7145 7135
7146 /* See if the binding is a keymap. Give up if it is. */ 7136 /* See if the binding is a keymap. Give up if it is. */
7147 if (!NILP (get_keymap_1 (PROP (TOOL_BAR_ITEM_BINDING), 0, 1))) 7137 if (CONSP (get_keymap (PROP (TOOL_BAR_ITEM_BINDING), 0, 1)))
7148 return 0; 7138 return 0;
7149 7139
7150 /* Enable or disable selection of item. */ 7140 /* Enable or disable selection of item. */
@@ -7627,7 +7617,7 @@ follow_key (key, nmaps, current, defs, next)
7627 /* Given the set of bindings we've found, produce the next set of maps. */ 7617 /* Given the set of bindings we've found, produce the next set of maps. */
7628 if (first_binding < nmaps) 7618 if (first_binding < nmaps)
7629 for (i = 0; i < nmaps; i++) 7619 for (i = 0; i < nmaps; i++)
7630 next[i] = NILP (defs[i]) ? Qnil : get_keymap_1 (defs[i], 0, 1); 7620 next[i] = NILP (defs[i]) ? Qnil : get_keymap (defs[i], 0, 1);
7631 7621
7632 return first_binding; 7622 return first_binding;
7633} 7623}
@@ -7793,11 +7783,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
7793 keytran_map = Vkey_translation_map; 7783 keytran_map = Vkey_translation_map;
7794 7784
7795 /* If there is no function-key-map, turn off function key scanning. */ 7785 /* If there is no function-key-map, turn off function key scanning. */
7796 if (NILP (Fkeymapp (Vfunction_key_map))) 7786 if (!KEYMAPP (Vfunction_key_map))
7797 fkey_start = fkey_end = bufsize + 1; 7787 fkey_start = fkey_end = bufsize + 1;
7798 7788
7799 /* If there is no key-translation-map, turn off scanning. */ 7789 /* If there is no key-translation-map, turn off scanning. */
7800 if (NILP (Fkeymapp (Vkey_translation_map))) 7790 if (!KEYMAPP (Vkey_translation_map))
7801 keytran_start = keytran_end = bufsize + 1; 7791 keytran_start = keytran_end = bufsize + 1;
7802 7792
7803 if (INTERACTIVE) 7793 if (INTERACTIVE)
@@ -8452,7 +8442,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8452 or an array. */ 8442 or an array. */
8453 if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next)) 8443 if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next))
8454 && (!NILP (Farrayp (XSYMBOL (fkey_next)->function)) 8444 && (!NILP (Farrayp (XSYMBOL (fkey_next)->function))
8455 || !NILP (Fkeymapp (XSYMBOL (fkey_next)->function)))) 8445 || KEYMAPP (XSYMBOL (fkey_next)->function)))
8456 fkey_next = XSYMBOL (fkey_next)->function; 8446 fkey_next = XSYMBOL (fkey_next)->function;
8457 8447
8458#if 0 /* I didn't turn this on, because it might cause trouble 8448#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 goto replay_sequence; 8515 goto replay_sequence;
8526 } 8516 }
8527 8517
8528 fkey_map = get_keymap_1 (fkey_next, 0, 1); 8518 fkey_map = get_keymap (fkey_next, 0, 1);
8529 8519
8530 /* If we no longer have a bound suffix, try a new positions for 8520 /* If we no longer have a bound suffix, try a new positions for
8531 fkey_start. */ 8521 fkey_start. */
8532 if (NILP (fkey_map)) 8522 if (!CONSP (fkey_map))
8533 { 8523 {
8534 fkey_end = ++fkey_start; 8524 fkey_end = ++fkey_start;
8535 fkey_map = Vfunction_key_map; 8525 fkey_map = Vfunction_key_map;
@@ -8562,7 +8552,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8562 or an array. */ 8552 or an array. */
8563 if (SYMBOLP (keytran_next) && ! NILP (Ffboundp (keytran_next)) 8553 if (SYMBOLP (keytran_next) && ! NILP (Ffboundp (keytran_next))
8564 && (!NILP (Farrayp (XSYMBOL (keytran_next)->function)) 8554 && (!NILP (Farrayp (XSYMBOL (keytran_next)->function))
8565 || !NILP (Fkeymapp (XSYMBOL (keytran_next)->function)))) 8555 || KEYMAPP (XSYMBOL (keytran_next)->function)))
8566 keytran_next = XSYMBOL (keytran_next)->function; 8556 keytran_next = XSYMBOL (keytran_next)->function;
8567 8557
8568 /* If the key translation map gives a function, not an 8558 /* If the key translation map gives a function, not an
@@ -8626,11 +8616,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8626 goto replay_sequence; 8616 goto replay_sequence;
8627 } 8617 }
8628 8618
8629 keytran_map = get_keymap_1 (keytran_next, 0, 1); 8619 keytran_map = get_keymap (keytran_next, 0, 1);
8630 8620
8631 /* If we no longer have a bound suffix, try a new positions for 8621 /* If we no longer have a bound suffix, try a new positions for
8632 keytran_start. */ 8622 keytran_start. */
8633 if (NILP (keytran_map)) 8623 if (!CONSP (keytran_map))
8634 { 8624 {
8635 keytran_end = ++keytran_start; 8625 keytran_end = ++keytran_start;
8636 keytran_map = Vkey_translation_map; 8626 keytran_map = Vkey_translation_map;
diff --git a/src/keyboard.h b/src/keyboard.h
index 1d0ac4e335c..61a52460809 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -291,8 +291,6 @@ extern Lisp_Object Qmode_line, Qvertical_line, Qheader_line;
291/* Forward declaration for prototypes. */ 291/* Forward declaration for prototypes. */
292struct input_event; 292struct input_event;
293 293
294extern Lisp_Object get_keymap_1 P_ ((Lisp_Object, int, int));
295EXFUN (Fkeymapp, 1);
296extern Lisp_Object parse_modifiers P_ ((Lisp_Object)); 294extern Lisp_Object parse_modifiers P_ ((Lisp_Object));
297extern Lisp_Object reorder_modifiers P_ ((Lisp_Object)); 295extern Lisp_Object reorder_modifiers P_ ((Lisp_Object));
298extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *)); 296extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
diff --git a/src/keymap.c b/src/keymap.c
index 0f61304a8e5..ccb39da186f 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -33,7 +33,6 @@ Boston, MA 02111-1307, USA. */
33#include "intervals.h" 33#include "intervals.h"
34 34
35#define min(a, b) ((a) < (b) ? (a) : (b)) 35#define min(a, b) ((a) < (b) ? (a) : (b))
36#define KEYMAPP(m) (!NILP (Fkeymapp (m)))
37 36
38/* The number of elements in keymap vectors. */ 37/* The number of elements in keymap vectors. */
39#define DENSE_TABLE_SIZE (0200) 38#define DENSE_TABLE_SIZE (0200)
@@ -190,8 +189,7 @@ is also allowed as an element.")
190 (object) 189 (object)
191 Lisp_Object object; 190 Lisp_Object object;
192{ 191{
193 /* FIXME: Maybe this should return t for autoloaded keymaps? -sm */ 192 return (KEYMAPP (object) ? Qt : Qnil);
194 return (NILP (get_keymap_1 (object, 0, 0)) ? Qnil : Qt);
195} 193}
196 194
197/* Check that OBJECT is a keymap (after dereferencing through any 195/* Check that OBJECT is a keymap (after dereferencing through any
@@ -201,6 +199,9 @@ is also allowed as an element.")
201 is an autoload form, do the autoload and try again. 199 is an autoload form, do the autoload and try again.
202 If AUTOLOAD is nonzero, callers must assume GC is possible. 200 If AUTOLOAD is nonzero, callers must assume GC is possible.
203 201
202 If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR
203 is zero as well), return Qt.
204
204 ERROR controls how we respond if OBJECT isn't a keymap. 205 ERROR controls how we respond if OBJECT isn't a keymap.
205 If ERROR is non-zero, signal an error; otherwise, just return Qnil. 206 If ERROR is non-zero, signal an error; otherwise, just return Qnil.
206 207
@@ -214,7 +215,7 @@ is also allowed as an element.")
214 do_autoload which can GC. */ 215 do_autoload which can GC. */
215 216
216Lisp_Object 217Lisp_Object
217get_keymap_1 (object, error, autoload) 218get_keymap (object, error, autoload)
218 Lisp_Object object; 219 Lisp_Object object;
219 int error, autoload; 220 int error, autoload;
220{ 221{
@@ -225,32 +226,35 @@ get_keymap_1 (object, error, autoload)
225 goto end; 226 goto end;
226 if (CONSP (object) && EQ (XCAR (object), Qkeymap)) 227 if (CONSP (object) && EQ (XCAR (object), Qkeymap))
227 return object; 228 return object;
228 else
229 {
230 tem = indirect_function (object);
231 if (CONSP (tem) && EQ (XCAR (tem), Qkeymap))
232 return tem;
233 }
234 229
235 /* Should we do an autoload? Autoload forms for keymaps have 230 tem = indirect_function (object);
236 Qkeymap as their fifth element. */ 231 if (CONSP (tem))
237 if (autoload
238 && SYMBOLP (object)
239 && CONSP (tem)
240 && EQ (XCAR (tem), Qautoload))
241 { 232 {
242 Lisp_Object tail; 233 if (EQ (XCAR (tem), Qkeymap))
234 return tem;
243 235
244 tail = Fnth (make_number (4), tem); 236 /* Should we do an autoload? Autoload forms for keymaps have
245 if (EQ (tail, Qkeymap)) 237 Qkeymap as their fifth element. */
238 if ((autoload || !error) && EQ (XCAR (tem), Qautoload))
246 { 239 {
247 struct gcpro gcpro1, gcpro2; 240 Lisp_Object tail;
248
249 GCPRO2 (tem, object);
250 do_autoload (tem, object);
251 UNGCPRO;
252 241
253 goto autoload_retry; 242 tail = Fnth (make_number (4), tem);
243 if (EQ (tail, Qkeymap))
244 {
245 if (autoload)
246 {
247 struct gcpro gcpro1, gcpro2;
248
249 GCPRO2 (tem, object);
250 do_autoload (tem, object);
251 UNGCPRO;
252
253 goto autoload_retry;
254 }
255 else
256 return Qt;
257 }
254 } 258 }
255 } 259 }
256 260
@@ -259,16 +263,6 @@ get_keymap_1 (object, error, autoload)
259 wrong_type_argument (Qkeymapp, object); 263 wrong_type_argument (Qkeymapp, object);
260 return Qnil; 264 return Qnil;
261} 265}
262
263
264/* Follow any symbol chaining, and return the keymap denoted by OBJECT.
265 If OBJECT doesn't denote a keymap at all, signal an error. */
266Lisp_Object
267get_keymap (object)
268 Lisp_Object object;
269{
270 return get_keymap_1 (object, 1, 0);
271}
272 266
273/* Return the parent map of the keymap MAP, or nil if it has none. 267/* Return the parent map of the keymap MAP, or nil if it has none.
274 We assume that MAP is a valid keymap. */ 268 We assume that MAP is a valid keymap. */
@@ -280,7 +274,7 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,
280{ 274{
281 Lisp_Object list; 275 Lisp_Object list;
282 276
283 keymap = get_keymap_1 (keymap, 1, 1); 277 keymap = get_keymap (keymap, 1, 1);
284 278
285 /* Skip past the initial element `keymap'. */ 279 /* Skip past the initial element `keymap'. */
286 list = XCDR (keymap); 280 list = XCDR (keymap);
@@ -291,7 +285,7 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,
291 return list; 285 return list;
292 } 286 }
293 287
294 return get_keymap_1(list, 0, 1); 288 return get_keymap (list, 0, 1);
295} 289}
296 290
297 291
@@ -327,12 +321,12 @@ PARENT should be nil or another keymap.")
327 This is a very minor correctness (rather than safety) issue. */ 321 This is a very minor correctness (rather than safety) issue. */
328 where_is_cache_keymaps = Qt; 322 where_is_cache_keymaps = Qt;
329 323
330 keymap = get_keymap_1 (keymap, 1, 1); 324 keymap = get_keymap (keymap, 1, 1);
331 GCPRO1 (keymap); 325 GCPRO1 (keymap);
332 326
333 if (!NILP (parent)) 327 if (!NILP (parent))
334 { 328 {
335 parent = get_keymap_1 (parent, 1, 1); 329 parent = get_keymap (parent, 1, 1);
336 330
337 /* Check for cycles. */ 331 /* Check for cycles. */
338 if (keymap_memberp (keymap, parent)) 332 if (keymap_memberp (keymap, parent))
@@ -404,22 +398,22 @@ fix_submap_inheritance (map, event, submap)
404 /* SUBMAP is a cons that we found as a key binding. 398 /* SUBMAP is a cons that we found as a key binding.
405 Discard the other things found in a menu key binding. */ 399 Discard the other things found in a menu key binding. */
406 400
407 submap = get_keymap_1 (get_keyelt (submap, 0), 0, 0); 401 submap = get_keymap (get_keyelt (submap, 0), 0, 0);
408 402
409 /* If it isn't a keymap now, there's no work to do. */ 403 /* If it isn't a keymap now, there's no work to do. */
410 if (NILP (submap)) 404 if (!CONSP (submap))
411 return; 405 return;
412 406
413 map_parent = Fkeymap_parent (map); 407 map_parent = Fkeymap_parent (map);
414 if (! NILP (map_parent)) 408 if (!NILP (map_parent))
415 parent_entry = 409 parent_entry =
416 get_keymap_1 (access_keymap (map_parent, event, 0, 0, 0), 0, 0); 410 get_keymap (access_keymap (map_parent, event, 0, 0, 0), 0, 0);
417 else 411 else
418 parent_entry = Qnil; 412 parent_entry = Qnil;
419 413
420 /* If MAP's parent has something other than a keymap, 414 /* If MAP's parent has something other than a keymap,
421 our own submap shadows it completely. */ 415 our own submap shadows it completely. */
422 if (NILP (parent_entry)) 416 if (!CONSP (parent_entry))
423 return; 417 return;
424 418
425 if (! EQ (parent_entry, submap)) 419 if (! EQ (parent_entry, submap))
@@ -489,10 +483,10 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
489 /* See if there is a meta-map. If there's none, there is 483 /* See if there is a meta-map. If there's none, there is
490 no binding for IDX, unless a default binding exists in MAP. */ 484 no binding for IDX, unless a default binding exists in MAP. */
491 Lisp_Object meta_map = 485 Lisp_Object meta_map =
492 get_keymap_1 (access_keymap (map, meta_prefix_char, 486 get_keymap (access_keymap (map, meta_prefix_char,
493 t_ok, noinherit, autoload), 487 t_ok, noinherit, autoload),
494 0, autoload); 488 0, autoload);
495 if (!NILP (meta_map)) 489 if (CONSP (meta_map))
496 { 490 {
497 map = meta_map; 491 map = meta_map;
498 idx = make_number (XUINT (idx) & ~meta_modifier); 492 idx = make_number (XUINT (idx) & ~meta_modifier);
@@ -512,8 +506,7 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
512 t_binding = Qnil; 506 t_binding = Qnil;
513 for (tail = XCDR (map); 507 for (tail = XCDR (map);
514 (CONSP (tail) 508 (CONSP (tail)
515 || (tail = get_keymap_1 (tail, 0, autoload), 509 || (tail = get_keymap (tail, 0, autoload), CONSP (tail)));
516 CONSP (tail)));
517 tail = XCDR (tail)) 510 tail = XCDR (tail))
518 { 511 {
519 Lisp_Object binding; 512 Lisp_Object binding;
@@ -666,8 +659,8 @@ get_keyelt (object, autoload)
666 else 659 else
667 { 660 {
668 Lisp_Object map; 661 Lisp_Object map;
669 map = get_keymap_1 (Fcar_safe (object), 0, autoload); 662 map = get_keymap (Fcar_safe (object), 0, autoload);
670 return (NILP (map) ? object /* Invalid keymap */ 663 return (!CONSP (map) ? object /* Invalid keymap */
671 : access_keymap (map, Fcdr (object), 0, 0, autoload)); 664 : access_keymap (map, Fcdr (object), 0, 0, autoload));
672 } 665 }
673 } 666 }
@@ -780,7 +773,7 @@ void
780copy_keymap_1 (chartable, idx, elt) 773copy_keymap_1 (chartable, idx, elt)
781 Lisp_Object chartable, idx, elt; 774 Lisp_Object chartable, idx, elt;
782{ 775{
783 if (!SYMBOLP (elt) && ! NILP (Fkeymapp (elt))) 776 if (CONSP (elt) && EQ (XCAR (elt), Qkeymap))
784 Faset (chartable, idx, Fcopy_keymap (elt)); 777 Faset (chartable, idx, Fcopy_keymap (elt));
785} 778}
786 779
@@ -796,7 +789,7 @@ is not copied.")
796{ 789{
797 register Lisp_Object copy, tail; 790 register Lisp_Object copy, tail;
798 791
799 copy = Fcopy_alist (get_keymap (keymap)); 792 copy = Fcopy_alist (get_keymap (keymap, 1, 0));
800 793
801 for (tail = copy; CONSP (tail); tail = XCDR (tail)) 794 for (tail = copy; CONSP (tail); tail = XCDR (tail))
802 { 795 {
@@ -820,8 +813,7 @@ is not copied.")
820 XCAR (tail) = elt; 813 XCAR (tail) = elt;
821 814
822 for (i = 0; i < ASIZE (elt); i++) 815 for (i = 0; i < ASIZE (elt); i++)
823 if (!SYMBOLP (AREF (elt, i)) 816 if (CONSP (AREF (elt, i)) && EQ (XCAR (AREF (elt, i)), Qkeymap))
824 && ! NILP (Fkeymapp (AREF (elt, i))))
825 ASET (elt, i, Fcopy_keymap (AREF (elt, i))); 817 ASET (elt, i, Fcopy_keymap (AREF (elt, i)));
826 } 818 }
827 else if (CONSP (elt) && CONSP (XCDR (elt))) 819 else if (CONSP (elt) && CONSP (XCDR (elt)))
@@ -853,7 +845,7 @@ is not copied.")
853 = Fcons (XCAR (tem), XCDR (tem)); 845 = Fcons (XCAR (tem), XCDR (tem));
854 elt = XCDR (elt); 846 elt = XCDR (elt);
855 tem = XCAR (elt); 847 tem = XCAR (elt);
856 if (!(SYMBOLP (tem) || NILP (Fkeymapp (tem)))) 848 if (CONSP (tem) && EQ (XCAR (tem), Qkeymap))
857 XCAR (elt) = Fcopy_keymap (tem); 849 XCAR (elt) = Fcopy_keymap (tem);
858 tem = XCDR (elt); 850 tem = XCDR (elt);
859 if (CONSP (tem) && CONSP (XCAR (tem))) 851 if (CONSP (tem) && CONSP (XCAR (tem)))
@@ -890,8 +882,8 @@ is not copied.")
890 XCDR (elt) = XCDR (tem); 882 XCDR (elt) = XCDR (tem);
891 } 883 }
892 if (CONSP (elt) 884 if (CONSP (elt)
893 && ! SYMBOLP (XCDR (elt)) 885 && CONSP (XCDR (elt))
894 && ! NILP (Fkeymapp (XCDR (elt)))) 886 && EQ (XCAR (XCDR (elt)), Qkeymap))
895 XCDR (elt) = Fcopy_keymap (XCDR (elt)); 887 XCDR (elt) = Fcopy_keymap (XCDR (elt));
896 } 888 }
897 889
@@ -938,7 +930,7 @@ the front of KEYMAP.")
938 int length; 930 int length;
939 struct gcpro gcpro1, gcpro2, gcpro3; 931 struct gcpro gcpro1, gcpro2, gcpro3;
940 932
941 keymap = get_keymap_1 (keymap, 1, 1); 933 keymap = get_keymap (keymap, 1, 1);
942 934
943 if (!VECTORP (key) && !STRINGP (key)) 935 if (!VECTORP (key) && !STRINGP (key))
944 key = wrong_type_argument (Qarrayp, key); 936 key = wrong_type_argument (Qarrayp, key);
@@ -993,8 +985,8 @@ the front of KEYMAP.")
993 if (NILP (cmd)) 985 if (NILP (cmd))
994 cmd = define_as_prefix (keymap, c); 986 cmd = define_as_prefix (keymap, c);
995 987
996 keymap = get_keymap_1 (cmd, 0, 1); 988 keymap = get_keymap (cmd, 0, 1);
997 if (NILP (keymap)) 989 if (!CONSP (keymap))
998 /* We must use Fkey_description rather than just passing key to 990 /* We must use Fkey_description rather than just passing key to
999 error; key might be a vector, not a string. */ 991 error; key might be a vector, not a string. */
1000 error ("Key sequence %s uses invalid prefix characters", 992 error ("Key sequence %s uses invalid prefix characters",
@@ -1032,7 +1024,7 @@ recognize the default bindings, just as `read-key-sequence' does.")
1032 int t_ok = ! NILP (accept_default); 1024 int t_ok = ! NILP (accept_default);
1033 struct gcpro gcpro1; 1025 struct gcpro gcpro1;
1034 1026
1035 keymap = get_keymap_1 (keymap, 1, 1); 1027 keymap = get_keymap (keymap, 1, 1);
1036 1028
1037 if (!VECTORP (key) && !STRINGP (key)) 1029 if (!VECTORP (key) && !STRINGP (key))
1038 key = wrong_type_argument (Qarrayp, key); 1030 key = wrong_type_argument (Qarrayp, key);
@@ -1059,8 +1051,8 @@ recognize the default bindings, just as `read-key-sequence' does.")
1059 if (idx == length) 1051 if (idx == length)
1060 RETURN_UNGCPRO (cmd); 1052 RETURN_UNGCPRO (cmd);
1061 1053
1062 keymap = get_keymap_1 (cmd, 0, 1); 1054 keymap = get_keymap (cmd, 0, 1);
1063 if (NILP (keymap)) 1055 if (!CONSP (keymap))
1064 RETURN_UNGCPRO (make_number (idx)); 1056 RETURN_UNGCPRO (make_number (idx));
1065 1057
1066 QUIT; 1058 QUIT;
@@ -1362,11 +1354,11 @@ bindings; see the description of `lookup-key' for more details about this.")
1362 GCPRO2 (key, binding); 1354 GCPRO2 (key, binding);
1363 1355
1364 for (i = j = 0; i < nmaps; i++) 1356 for (i = j = 0; i < nmaps; i++)
1365 if (! NILP (maps[i]) 1357 if (!NILP (maps[i])
1366 && ! NILP (binding = Flookup_key (maps[i], key, accept_default)) 1358 && !NILP (binding = Flookup_key (maps[i], key, accept_default))
1367 && !INTEGERP (binding)) 1359 && !INTEGERP (binding))
1368 { 1360 {
1369 if (! NILP (get_keymap (binding))) 1361 if (KEYMAPP (binding))
1370 maps[j++] = Fcons (modes[i], binding); 1362 maps[j++] = Fcons (modes[i], binding);
1371 else if (j == 0) 1363 else if (j == 0)
1372 RETURN_UNGCPRO (Fcons (Fcons (modes[i], binding), Qnil)); 1364 RETURN_UNGCPRO (Fcons (Fcons (modes[i], binding), Qnil));
@@ -1402,7 +1394,7 @@ DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0,
1402 (keymap) 1394 (keymap)
1403 Lisp_Object keymap; 1395 Lisp_Object keymap;
1404{ 1396{
1405 keymap = get_keymap (keymap); 1397 keymap = get_keymap (keymap, 1, 1);
1406 current_global_map = keymap; 1398 current_global_map = keymap;
1407 1399
1408 return Qnil; 1400 return Qnil;
@@ -1415,7 +1407,7 @@ If KEYMAP is nil, that means no local keymap.")
1415 Lisp_Object keymap; 1407 Lisp_Object keymap;
1416{ 1408{
1417 if (!NILP (keymap)) 1409 if (!NILP (keymap))
1418 keymap = get_keymap (keymap); 1410 keymap = get_keymap (keymap, 1, 1);
1419 1411
1420 current_buffer->keymap = keymap; 1412 current_buffer->keymap = keymap;
1421 1413
@@ -1480,8 +1472,8 @@ then the value includes only maps for prefixes that start with PREFIX.")
1480 /* Flookup_key may give us nil, or a number, 1472 /* Flookup_key may give us nil, or a number,
1481 if the prefix is not defined in this particular map. 1473 if the prefix is not defined in this particular map.
1482 It might even give us a list that isn't a keymap. */ 1474 It might even give us a list that isn't a keymap. */
1483 tem = get_keymap_1 (tem, 0, 0); 1475 tem = get_keymap (tem, 0, 0);
1484 if (!NILP (tem)) 1476 if (CONSP (tem))
1485 { 1477 {
1486 /* Convert PREFIX to a vector now, so that later on 1478 /* Convert PREFIX to a vector now, so that later on
1487 we don't have to deal with the possibility of a string. */ 1479 we don't have to deal with the possibility of a string. */
@@ -1509,7 +1501,7 @@ then the value includes only maps for prefixes that start with PREFIX.")
1509 } 1501 }
1510 else 1502 else
1511 maps = Fcons (Fcons (Fmake_vector (make_number (0), Qnil), 1503 maps = Fcons (Fcons (Fmake_vector (make_number (0), Qnil),
1512 get_keymap (keymap)), 1504 get_keymap (keymap, 1, 0)),
1513 Qnil); 1505 Qnil);
1514 1506
1515 /* For each map in the list maps, 1507 /* For each map in the list maps,
@@ -1562,10 +1554,10 @@ then the value includes only maps for prefixes that start with PREFIX.")
1562 1554
1563 cmd = get_keyelt (AREF (elt, i), 0); 1555 cmd = get_keyelt (AREF (elt, i), 0);
1564 if (NILP (cmd)) continue; 1556 if (NILP (cmd)) continue;
1565 tem = Fkeymapp (cmd); 1557 tem = get_keymap (cmd, 0, 0);
1566 if (!NILP (tem)) 1558 if (CONSP (tem))
1567 { 1559 {
1568 cmd = get_keymap (cmd); 1560 cmd = tem;
1569 /* Ignore keymaps that are already added to maps. */ 1561 /* Ignore keymaps that are already added to maps. */
1570 tem = Frassq (cmd, maps); 1562 tem = Frassq (cmd, maps);
1571 if (NILP (tem)) 1563 if (NILP (tem))
@@ -1603,11 +1595,11 @@ then the value includes only maps for prefixes that start with PREFIX.")
1603 1595
1604 cmd = get_keyelt (XCDR (elt), 0); 1596 cmd = get_keyelt (XCDR (elt), 0);
1605 /* Ignore definitions that aren't keymaps themselves. */ 1597 /* Ignore definitions that aren't keymaps themselves. */
1606 tem = Fkeymapp (cmd); 1598 tem = get_keymap (cmd, 0, 0);
1607 if (!NILP (tem)) 1599 if (CONSP (tem))
1608 { 1600 {
1609 /* Ignore keymaps that have been seen already. */ 1601 /* Ignore keymaps that have been seen already. */
1610 cmd = get_keymap (cmd); 1602 cmd = tem;
1611 tem = Frassq (cmd, maps); 1603 tem = Frassq (cmd, maps);
1612 if (NILP (tem)) 1604 if (NILP (tem))
1613 { 1605 {
@@ -1687,10 +1679,10 @@ accessible_keymaps_char_table (args, index, cmd)
1687 tail = XCAR (XCDR (args)); 1679 tail = XCAR (XCDR (args));
1688 thisseq = XCDR (XCDR (args)); 1680 thisseq = XCDR (XCDR (args));
1689 1681
1690 tem = Fkeymapp (cmd); 1682 tem = get_keymap (cmd, 0, 0);
1691 if (!NILP (tem)) 1683 if (CONSP (tem))
1692 { 1684 {
1693 cmd = get_keymap (cmd); 1685 cmd = tem;
1694 /* Ignore keymaps that are already added to maps. */ 1686 /* Ignore keymaps that are already added to maps. */
1695 tem = Frassq (cmd, maps); 1687 tem = Frassq (cmd, maps);
1696 if (NILP (tem)) 1688 if (NILP (tem))
@@ -2087,7 +2079,8 @@ where_is_internal (definition, keymaps, firstonly, noindirect)
2087 while (CONSP (found)) 2079 while (CONSP (found))
2088 { 2080 {
2089 maps = 2081 maps =
2090 nconc2 (maps, Faccessible_keymaps (get_keymap (XCAR (found)), Qnil)); 2082 nconc2 (maps,
2083 Faccessible_keymaps (get_keymap (XCAR (found), 1, 0), Qnil));
2091 found = XCDR (found); 2084 found = XCDR (found);
2092 } 2085 }
2093 2086
@@ -2667,7 +2660,7 @@ key binding\n\
2667 /* If shmap is not nil and not a keymap, 2660 /* If shmap is not nil and not a keymap,
2668 it completely shadows this map, so don't 2661 it completely shadows this map, so don't
2669 describe this map at all. */ 2662 describe this map at all. */
2670 if (!NILP (shmap) && NILP (Fkeymapp (shmap))) 2663 if (!NILP (shmap) && !KEYMAPP (shmap))
2671 goto skip; 2664 goto skip;
2672 2665
2673 if (!NILP (shmap)) 2666 if (!NILP (shmap))
@@ -2729,14 +2722,10 @@ describe_command (definition)
2729 } 2722 }
2730 else if (STRINGP (definition) || VECTORP (definition)) 2723 else if (STRINGP (definition) || VECTORP (definition))
2731 insert_string ("Keyboard Macro\n"); 2724 insert_string ("Keyboard Macro\n");
2725 else if (KEYMAPP (definition))
2726 insert_string ("Prefix Command\n");
2732 else 2727 else
2733 { 2728 insert_string ("??\n");
2734 tem1 = Fkeymapp (definition);
2735 if (!NILP (tem1))
2736 insert_string ("Prefix Command\n");
2737 else
2738 insert_string ("??\n");
2739 }
2740} 2729}
2741 2730
2742static void 2731static void
@@ -2758,14 +2747,10 @@ describe_translation (definition)
2758 insert1 (Fkey_description (definition)); 2747 insert1 (Fkey_description (definition));
2759 insert_string ("\n"); 2748 insert_string ("\n");
2760 } 2749 }
2750 else if (KEYMAPP (definition))
2751 insert_string ("Prefix Command\n");
2761 else 2752 else
2762 { 2753 insert_string ("??\n");
2763 tem1 = Fkeymapp (definition);
2764 if (!NILP (tem1))
2765 insert_string ("Prefix Command\n");
2766 else
2767 insert_string ("??\n");
2768 }
2769} 2754}
2770 2755
2771/* Describe the contents of map MAP, assuming that this map itself is 2756/* Describe the contents of map MAP, assuming that this map itself is
diff --git a/src/lisp.h b/src/lisp.h
index fcc6212a369..0d758695d34 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2582,6 +2582,7 @@ extern void keys_of_keyboard P_ ((void));
2582 2582
2583/* defined in keymap.c */ 2583/* defined in keymap.c */
2584 2584
2585#define KEYMAPP(m) (!NILP (get_keymap (m, 0, 0)))
2585extern Lisp_Object Qkeymap, Qmenu_bar; 2586extern Lisp_Object Qkeymap, Qmenu_bar;
2586extern Lisp_Object current_global_map; 2587extern Lisp_Object current_global_map;
2587EXFUN (Fmake_sparse_keymap, 1); 2588EXFUN (Fmake_sparse_keymap, 1);
@@ -2594,8 +2595,7 @@ EXFUN (Fsingle_key_description, 2);
2594EXFUN (Fwhere_is_internal, 4); 2595EXFUN (Fwhere_is_internal, 4);
2595extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int)); 2596extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int));
2596extern Lisp_Object get_keyelt P_ ((Lisp_Object, int)); 2597extern Lisp_Object get_keyelt P_ ((Lisp_Object, int));
2597extern Lisp_Object get_keymap P_ ((Lisp_Object)); 2598extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int));
2598extern Lisp_Object get_keymap_1 P_ ((Lisp_Object, int, int));
2599extern void describe_vector P_ ((Lisp_Object, Lisp_Object, 2599extern void describe_vector P_ ((Lisp_Object, Lisp_Object,
2600 void (*) (Lisp_Object), int, 2600 void (*) (Lisp_Object), int,
2601 Lisp_Object, Lisp_Object, int *, int)); 2601 Lisp_Object, Lisp_Object, int *, int));
diff --git a/src/minibuf.c b/src/minibuf.c
index 5edd58e3a89..23365c722c8 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -817,7 +817,7 @@ DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1,
817 if (NILP (keymap)) 817 if (NILP (keymap))
818 keymap = Vminibuffer_local_map; 818 keymap = Vminibuffer_local_map;
819 else 819 else
820 keymap = get_keymap (keymap); 820 keymap = get_keymap (keymap, 1, 0);
821 821
822 if (SYMBOLP (hist)) 822 if (SYMBOLP (hist))
823 { 823 {
diff --git a/src/w32menu.c b/src/w32menu.c
index b62f7af2776..f2d97e81536 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -53,9 +53,6 @@ Boston, MA 02111-1307, USA. */
53typedef void * XtPointer; 53typedef void * XtPointer;
54typedef char Boolean; 54typedef char Boolean;
55 55
56#define True 1
57#define False 0
58
59enum button_type 56enum button_type
60{ 57{
61 BUTTON_TYPE_NONE, 58 BUTTON_TYPE_NONE,
@@ -722,15 +719,11 @@ cached information about equivalent key sequences.")
722 719
723 /* Decode the menu items from what was specified. */ 720 /* Decode the menu items from what was specified. */
724 721
725 keymap = Fkeymapp (menu); 722 keymap = get_keymap (menu, 0, 0);
726 tem = Qnil; 723 if (CONSP (keymap))
727 if (CONSP (menu))
728 tem = Fkeymapp (Fcar (menu));
729 if (!NILP (keymap))
730 { 724 {
731 /* We were given a keymap. Extract menu info from the keymap. */ 725 /* We were given a keymap. Extract menu info from the keymap. */
732 Lisp_Object prompt; 726 Lisp_Object prompt;
733 keymap = get_keymap (menu);
734 727
735 /* Extract the detailed info to make one pane. */ 728 /* Extract the detailed info to make one pane. */
736 keymap_panes (&menu, 1, NILP (position)); 729 keymap_panes (&menu, 1, NILP (position));
@@ -747,7 +740,7 @@ cached information about equivalent key sequences.")
747 740
748 keymaps = 1; 741 keymaps = 1;
749 } 742 }
750 else if (!NILP (tem)) 743 else if (CONSP (menu) && KEYMAPP (XCAR (menu)))
751 { 744 {
752 /* We were given a list of keymaps. */ 745 /* We were given a list of keymaps. */
753 int nmaps = XFASTINT (Flength (menu)); 746 int nmaps = XFASTINT (Flength (menu));
@@ -763,7 +756,7 @@ cached information about equivalent key sequences.")
763 { 756 {
764 Lisp_Object prompt; 757 Lisp_Object prompt;
765 758
766 maps[i++] = keymap = get_keymap (Fcar (tem)); 759 maps[i++] = keymap = get_keymap (Fcar (tem), 1, 0);
767 760
768 prompt = map_prompt (keymap); 761 prompt = map_prompt (keymap);
769 if (NILP (title) && !NILP (prompt)) 762 if (NILP (title) && !NILP (prompt))
@@ -1117,8 +1110,7 @@ single_submenu (item_key, item_name, maps)
1117 for (i = 0; i < len; i++) 1110 for (i = 0; i < len; i++)
1118 { 1111 {
1119 if (SYMBOLP (mapvec[i]) 1112 if (SYMBOLP (mapvec[i])
1120 || (CONSP (mapvec[i]) 1113 || (CONSP (mapvec[i]) && !KEYMAPP (mapvec[i])))
1121 && NILP (Fkeymapp (mapvec[i]))))
1122 { 1114 {
1123 /* Here we have a command at top level in the menu bar 1115 /* Here we have a command at top level in the menu bar
1124 as opposed to a submenu. */ 1116 as opposed to a submenu. */
@@ -1734,8 +1726,8 @@ w32_menu_show (f, x, y, for_click, keymaps, title, error)
1734 title = ENCODE_SYSTEM (title); 1726 title = ENCODE_SYSTEM (title);
1735#endif 1727#endif
1736 wv_title->name = (char *) XSTRING (title)->data; 1728 wv_title->name = (char *) XSTRING (title)->data;
1737 wv_title->enabled = True; 1729 wv_title->enabled = TRUE;
1738 wv_title->title = True; 1730 wv_title->title = TRUE;
1739 wv_title->button_type = BUTTON_TYPE_NONE; 1731 wv_title->button_type = BUTTON_TYPE_NONE;
1740 wv_title->next = wv_sep; 1732 wv_title->next = wv_sep;
1741 first_wv->contents = wv_title; 1733 first_wv->contents = wv_title;
@@ -1954,7 +1946,7 @@ w32_dialog_show (f, keymaps, title, error)
1954 menu = lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv, 1946 menu = lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv,
1955 f->output_data.w32->widget, 1, 0, 1947 f->output_data.w32->widget, 1, 0,
1956 dialog_selection_callback, 0); 1948 dialog_selection_callback, 0);
1957 lw_modify_all_widgets (dialog_id, first_wv->contents, True); 1949 lw_modify_all_widgets (dialog_id, first_wv->contents, TRUE);
1958#endif 1950#endif
1959 1951
1960 /* Free the widget_value objects we used to specify the contents. */ 1952 /* Free the widget_value objects we used to specify the contents. */
diff --git a/src/w32term.c b/src/w32term.c
index 23cde3c0522..4bea6a87c61 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5931,7 +5931,7 @@ note_mode_line_highlight (w, x, mode_line_p)
5931 /* Change the mouse pointer according to what is under X/Y. */ 5931 /* Change the mouse pointer according to what is under X/Y. */
5932 map = Fget_text_property (make_number (glyph->charpos), 5932 map = Fget_text_property (make_number (glyph->charpos),
5933 Qlocal_map, glyph->object); 5933 Qlocal_map, glyph->object);
5934 if (!NILP (Fkeymapp (map))) 5934 if (KEYMAPP (map))
5935 cursor = f->output_data.w32->nontext_cursor; 5935 cursor = f->output_data.w32->nontext_cursor;
5936 } 5936 }
5937 } 5937 }
diff --git a/src/xmenu.c b/src/xmenu.c
index db20b6b0b61..6511185bad7 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -38,9 +38,9 @@ Boston, MA 02111-1307, USA. */
38#include <stdio.h> 38#include <stdio.h>
39#include "lisp.h" 39#include "lisp.h"
40#include "termhooks.h" 40#include "termhooks.h"
41#include "keyboard.h"
41#include "frame.h" 42#include "frame.h"
42#include "window.h" 43#include "window.h"
43#include "keyboard.h"
44#include "blockinput.h" 44#include "blockinput.h"
45#include "buffer.h" 45#include "buffer.h"
46 46
@@ -788,15 +788,11 @@ cached information about equivalent key sequences.")
788 788
789 /* Decode the menu items from what was specified. */ 789 /* Decode the menu items from what was specified. */
790 790
791 keymap = Fkeymapp (menu); 791 keymap = get_keymap (menu, 0, 0);
792 tem = Qnil; 792 if (CONSP (keymap))
793 if (CONSP (menu))
794 tem = Fkeymapp (Fcar (menu));
795 if (!NILP (keymap))
796 { 793 {
797 /* We were given a keymap. Extract menu info from the keymap. */ 794 /* We were given a keymap. Extract menu info from the keymap. */
798 Lisp_Object prompt; 795 Lisp_Object prompt;
799 keymap = get_keymap (menu);
800 796
801 /* Extract the detailed info to make one pane. */ 797 /* Extract the detailed info to make one pane. */
802 keymap_panes (&menu, 1, NILP (position)); 798 keymap_panes (&menu, 1, NILP (position));
@@ -813,7 +809,7 @@ cached information about equivalent key sequences.")
813 809
814 keymaps = 1; 810 keymaps = 1;
815 } 811 }
816 else if (!NILP (tem)) 812 else if (CONSP (menu) && KEYMAPP (XCAR (menu)))
817 { 813 {
818 /* We were given a list of keymaps. */ 814 /* We were given a list of keymaps. */
819 int nmaps = XFASTINT (Flength (menu)); 815 int nmaps = XFASTINT (Flength (menu));
@@ -829,7 +825,7 @@ cached information about equivalent key sequences.")
829 { 825 {
830 Lisp_Object prompt; 826 Lisp_Object prompt;
831 827
832 maps[i++] = keymap = get_keymap (Fcar (tem)); 828 maps[i++] = keymap = get_keymap (Fcar (tem), 1, 0);
833 829
834 prompt = map_prompt (keymap); 830 prompt = map_prompt (keymap);
835 if (NILP (title) && !NILP (prompt)) 831 if (NILP (title) && !NILP (prompt))
@@ -1396,8 +1392,7 @@ single_submenu (item_key, item_name, maps)
1396 for (i = 0; i < len; i++) 1392 for (i = 0; i < len; i++)
1397 { 1393 {
1398 if (SYMBOLP (mapvec[i]) 1394 if (SYMBOLP (mapvec[i])
1399 || (CONSP (mapvec[i]) 1395 || (CONSP (mapvec[i]) && !KEYMAPP (mapvec[i])))
1400 && NILP (Fkeymapp (mapvec[i]))))
1401 { 1396 {
1402 /* Here we have a command at top level in the menu bar 1397 /* Here we have a command at top level in the menu bar
1403 as opposed to a submenu. */ 1398 as opposed to a submenu. */
diff --git a/src/xterm.c b/src/xterm.c
index 2d818a1e4ff..a55117ba8dc 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6502,13 +6502,13 @@ note_mode_line_highlight (w, x, mode_line_p)
6502 /* Change the mouse pointer according to what is under X/Y. */ 6502 /* Change the mouse pointer according to what is under X/Y. */
6503 map = Fget_text_property (make_number (glyph->charpos), 6503 map = Fget_text_property (make_number (glyph->charpos),
6504 Qlocal_map, glyph->object); 6504 Qlocal_map, glyph->object);
6505 if (!NILP (Fkeymapp (map))) 6505 if (KEYMAPP (map))
6506 cursor = f->output_data.x->nontext_cursor; 6506 cursor = f->output_data.x->nontext_cursor;
6507 else 6507 else
6508 { 6508 {
6509 map = Fget_text_property (make_number (glyph->charpos), 6509 map = Fget_text_property (make_number (glyph->charpos),
6510 Qkeymap, glyph->object); 6510 Qkeymap, glyph->object);
6511 if (!NILP (Fkeymapp (map))) 6511 if (KEYMAPP (map))
6512 cursor = f->output_data.x->nontext_cursor; 6512 cursor = f->output_data.x->nontext_cursor;
6513 } 6513 }
6514 } 6514 }