summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 @@
+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
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
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;
}
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)
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)
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)
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 @@ menu_bar_items (old)
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 @@ menu_bar_one_keymap (keymap)
{
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 @@ parse_menu_item (item, notreal, inmenubar)
/* 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 @@ tool_bar_items (reuse, nitems)
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 @@ parse_tool_bar_item (key, item)
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 @@ follow_key (key, nmaps, current, defs, next)
/* 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 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
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 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
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 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
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 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
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 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
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;
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;
/* 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 *));
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. */
#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 @@ is also allowed as an element.")
(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 also allowed as an element.")
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 @@ is also allowed as an element.")
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 @@ get_keymap_1 (object, error, autoload)
goto end;
if (CONSP (object) && EQ (XCAR (object), Qkeymap))
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
- Qkeymap as their fifth element. */
- if (autoload
- && SYMBOLP (object)
- && CONSP (tem)
- && EQ (XCAR (tem), Qautoload))
+ tem = indirect_function (object);
+ if (CONSP (tem))
{
- Lisp_Object tail;
+ if (EQ (XCAR (tem), Qkeymap))
+ return tem;
- 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;
+ Lisp_Object tail;
- 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)
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 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,
{
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 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,
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.")
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 @@ fix_submap_inheritance (map, event, submap)
/* 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 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
/* 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 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
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 @@ get_keyelt (object, autoload)
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 @@ void
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 @@ is not copied.")
{
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 @@ is not copied.")
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 @@ is not copied.")
= 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 @@ is not copied.")
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 @@ the front of KEYMAP.")
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 @@ the front of KEYMAP.")
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 @@ recognize the default bindings, just as `read-key-sequence' does.")
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 @@ recognize the default bindings, just as `read-key-sequence' does.")
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 @@ bindings; see the description of `lookup-key' for more details about this.")
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 @@ DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0,
(keymap)
Lisp_Object keymap;
{
- keymap = get_keymap (keymap);
+ keymap = get_keymap (keymap, 1, 1);
current_global_map = keymap;
return Qnil;
@@ -1415,7 +1407,7 @@ If KEYMAP is nil, that means no local keymap.")
Lisp_Object keymap;
{
if (!NILP (keymap))
- keymap = get_keymap (keymap);
+ keymap = get_keymap (keymap, 1, 1);
current_buffer->keymap = keymap;
@@ -1480,8 +1472,8 @@ then the value includes only maps for prefixes that start with PREFIX.")
/* 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 @@ then the value includes only maps for prefixes that start with PREFIX.")
}
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 @@ then the value includes only maps for prefixes that start with PREFIX.")
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 @@ then the value includes only maps for prefixes that start with PREFIX.")
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 @@ accessible_keymaps_char_table (args, index, cmd)
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 @@ where_is_internal (definition, keymaps, firstonly, noindirect)
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 @@ key binding\n\
/* 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 @@ describe_command (definition)
}
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 @@ describe_translation (definition)
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
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));
/* 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 (Fsingle_key_description, 2);
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));
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,
if (NILP (keymap))
keymap = Vminibuffer_local_map;
else
- keymap = get_keymap (keymap);
+ keymap = get_keymap (keymap, 1, 0);
if (SYMBOLP (hist))
{
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. */
typedef void * XtPointer;
typedef char Boolean;
-#define True 1
-#define False 0
-
enum button_type
{
BUTTON_TYPE_NONE,
@@ -722,15 +719,11 @@ cached information about equivalent key sequences.")
/* 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 @@ cached information about equivalent key sequences.")
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 @@ cached information about equivalent key sequences.")
{
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 @@ single_submenu (item_key, item_name, maps)
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 @@ w32_menu_show (f, x, y, for_click, keymaps, title, error)
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 @@ w32_dialog_show (f, keymaps, title, error)
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. */
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)
/* 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;
}
}
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. */
#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 @@ cached information about equivalent key sequences.")
/* 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 @@ cached information about equivalent key sequences.")
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 @@ cached information about equivalent key sequences.")
{
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 @@ single_submenu (item_key, item_name, maps)
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. */
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)
/* 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;
}
}