#include "keymap.h"
#include "window.h"
-/* Actually allocate storage for these variables */
+/* Actually allocate storage for these variables. */
-Lisp_Object current_global_map; /* Current global keymap */
+Lisp_Object current_global_map; /* Current global keymap. */
-Lisp_Object global_map; /* default global key bindings */
+Lisp_Object global_map; /* Default global key bindings. */
Lisp_Object meta_map; /* The keymap used for globally bound
- ESC-prefixed default commands */
+ ESC-prefixed default commands. */
Lisp_Object control_x_map; /* The keymap used for globally bound
- C-x-prefixed default commands */
+ C-x-prefixed default commands. */
/* The keymap used by the minibuf for local
bindings when spaces are allowed in the
- minibuf */
+ minibuf. */
/* The keymap used by the minibuf for local
bindings when spaces are not encouraged
- in the minibuf */
+ in the minibuf. */
-/* keymap used for minibuffers when doing completion */
-/* keymap used for minibuffers when doing completion and require a match */
+/* Keymap used for minibuffers when doing completion. */
+/* Keymap used for minibuffers when doing completion and require a match. */
static Lisp_Object Qkeymapp, Qnon_ascii;
Lisp_Object Qkeymap, Qmenu_item, Qremap;
static Lisp_Object QCadvertised_binding;
Lisp_Object, Lisp_Object, bool, bool);
static void silly_event_symbol_error (Lisp_Object);
static Lisp_Object get_keyelt (Lisp_Object, bool);
+
+static void
+CHECK_VECTOR_OR_CHAR_TABLE (Lisp_Object x)
+{
+ CHECK_TYPE (VECTORP (x) || CHAR_TABLE_P (x), Qvector_or_char_table_p, x);
+}
\f
/* Keymap object support - constructors and predicates. */
{
Lisp_Object tail;
if (!NILP (string))
- tail = Fcons (string, Qnil);
+ tail = list1 (string);
else
tail = Qnil;
return Fcons (Qkeymap,
{
if (!NILP (Vpurify_flag))
string = Fpurecopy (string);
- return Fcons (Qkeymap, Fcons (string, Qnil));
+ return list2 (Qkeymap, string);
}
- return Fcons (Qkeymap, Qnil);
+ return list1 (Qkeymap);
}
/* This function is used for installing the standard key bindings
retval = val;
else if (CONSP (retval_tail))
{
- XSETCDR (retval_tail, Fcons (val, Qnil));
+ XSETCDR (retval_tail, list1 (val));
retval_tail = XCDR (retval_tail);
}
else
{
- retval_tail = Fcons (val, Qnil);
+ retval_tail = list1 (val);
retval = Fcons (Qkeymap, Fcons (retval, retval_tail));
}
}
if (!NILP (val))
{
map_keymap_function_t fun
- = (map_keymap_function_t) XSAVE_POINTER (args, 0);
+ = (map_keymap_function_t) XSAVE_FUNCPOINTER (args, 0);
/* If the key is a range, make a copy since map_char_table modifies
it in place. */
if (CONSP (key))
}
else if (CHAR_TABLE_P (binding))
map_char_table (map_keymap_char_table_item, Qnil, binding,
- make_save_value (SAVE_TYPE_PTR_PTR_OBJ,
- fun, data, args));
+ make_save_funcptr_ptr_obj ((voidfuncptr) fun, data,
+ args));
}
UNGCPRO;
return tail;
is not copied. */)
(Lisp_Object keymap)
{
- register Lisp_Object copy, tail;
+ Lisp_Object copy, tail;
keymap = get_keymap (keymap, 1, 0);
- copy = tail = Fcons (Qkeymap, Qnil);
+ copy = tail = list1 (Qkeymap);
keymap = XCDR (keymap); /* Skip the `keymap' symbol. */
while (CONSP (keymap) && !EQ (XCAR (keymap), Qkeymap))
else
elt = Fcons (XCAR (elt), copy_keymap_item (XCDR (elt)));
}
- XSETCDR (tail, Fcons (elt, Qnil));
+ XSETCDR (tail, list1 (elt));
tail = XCDR (tail);
keymap = XCDR (keymap);
}
Lisp_Object args[2];
args[0] = key_sequence;
-
- args[1] = Fcons (key, Qnil);
+ args[1] = list1 (key);
return Fvconcat (2, args);
}
{
ptrdiff_t count = SPECPDL_INDEX ();
- Lisp_Object keymaps = Fcons (current_global_map, Qnil);
+ Lisp_Object keymaps = list1 (current_global_map);
/* If a mouse click position is given, our variables are based on
the buffer clicked on, not the current buffer. So we may have to
}
}
- if (!NILP (olp))
- {
- if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
- keymaps = Fcons (KVAR (current_kboard, Voverriding_terminal_local_map),
- keymaps);
+ if (!NILP (olp)
/* The doc said that overriding-terminal-local-map should
override overriding-local-map. The code used them both,
but it seems clearer to use just one. rms, jan 2005. */
- else if (!NILP (Voverriding_local_map))
- keymaps = Fcons (Voverriding_local_map, keymaps);
- }
+ && NILP (KVAR (current_kboard, Voverriding_terminal_local_map))
+ && !NILP (Voverriding_local_map))
+ keymaps = Fcons (Voverriding_local_map, keymaps);
+
if (NILP (XCDR (keymaps)))
{
Lisp_Object *maps;
Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map);
/* This returns nil unless there is a `keymap' property. */
Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap);
+ Lisp_Object otlp = KVAR (current_kboard, Voverriding_terminal_local_map);
if (CONSP (position))
{
if (!NILP (keymap))
keymaps = Fcons (keymap, keymaps);
+
+ if (!NILP (olp) && !NILP (otlp))
+ keymaps = Fcons (otlp, keymaps);
}
unbind_to (count, Qnil);
if (KEYMAPP (binding))
maps[j++] = Fcons (modes[i], binding);
else if (j == 0)
- RETURN_UNGCPRO (Fcons (Fcons (modes[i], binding), Qnil));
+ RETURN_UNGCPRO (list1 (Fcons (modes[i], binding)));
}
UNGCPRO;
else
{
tem = append_key (thisseq, key);
- nconc2 (tail, Fcons (Fcons (tem, cmd), Qnil));
+ nconc2 (tail, list1 (Fcons (tem, cmd)));
}
}
}
prefix = copy;
}
- maps = Fcons (Fcons (prefix, tem), Qnil);
+ maps = list1 (Fcons (prefix, tem));
}
else
return Qnil;
}
else
- maps = Fcons (Fcons (zero_vector, get_keymap (keymap, 1, 0)), Qnil);
+ maps = list1 (Fcons (zero_vector, get_keymap (keymap, 1, 0)));
/* For each map in the list maps,
look at any other maps it points to,
if (CONSP (keymap) && KEYMAPP (XCAR (keymap)))
keymaps = keymap;
else if (!NILP (keymap))
- keymaps = Fcons (keymap, Fcons (current_global_map, Qnil));
+ keymaps = list2 (keymap, current_global_map);
else
keymaps = Fcurrent_active_maps (Qnil, Qnil);
insert ("\n", 1);
- /* Insert calls signal_after_change which may GC. */
+ /* Insert calls signal_after_change which may GC. */
translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table));
}
start1 = Qnil;
if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
start1 = KVAR (current_kboard, Voverriding_terminal_local_map);
+
+ if (!NILP (start1))
+ {
+ describe_map_tree (start1, 1, shadow, prefix,
+ "\f\nOverriding Bindings", nomenu, 0, 0, 0);
+ shadow = Fcons (start1, shadow);
+ start1 = Qnil;
+ }
else if (!NILP (Voverriding_local_map))
start1 = Voverriding_local_map;
for (tail = map; CONSP (tail); tail = XCDR (tail))
length_needed++;
- vect = ((struct describe_map_elt *)
- alloca (sizeof (struct describe_map_elt) * length_needed));
+ vect = alloca (length_needed * sizeof *vect);
for (tail = map; CONSP (tail); tail = XCDR (tail))
{
if (vect[i].shadowed)
{
- SET_PT (PT - 1);
+ ptrdiff_t pt = max (PT - 1, BEG);
+
+ SET_PT (pt);
insert_string ("\n (that binding is currently shadowed by another mode)");
- SET_PT (PT + 1);
+ pt = min (PT + 1, Z);
+ SET_PT (pt);
}
}