/* Manipulation of keymaps
- Copyright (C) 1985-1988, 1993-1995, 1998-2013 Free Software
+ Copyright (C) 1985-1988, 1993-1995, 1998-2014 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
/* This is really the value. */
return object;
- /* If the keymap contents looks like (keymap ...) or (lambda ...)
- then use itself. */
- else if (EQ (XCAR (object), Qkeymap) || EQ (XCAR (object), Qlambda))
- return object;
-
/* If the keymap contents looks like (menu-item name . DEFN)
or (menu-item name DEFN ...) then use DEFN.
This is a new format menu item. */
Keymap alist elements like (CHAR MENUSTRING . DEFN)
will be used by HierarKey menus. */
else if (STRINGP (XCAR (object)))
- {
- object = XCDR (object);
- /* Also remove a menu help string, if any,
- following the menu item name. */
- if (CONSP (object) && STRINGP (XCAR (object)))
- object = XCDR (object);
- /* Also remove the sublist that caches key equivalences, if any. */
- if (CONSP (object) && CONSP (XCAR (object)))
- {
- Lisp_Object carcar;
- carcar = XCAR (XCAR (object));
- if (NILP (carcar) || VECTORP (carcar))
- object = XCDR (object);
- }
- }
+ object = XCDR (object);
- /* If the contents are (KEYMAP . ELEMENT), go indirect. */
- else if (KEYMAPP (XCAR (object)))
- error ("Wow, indirect keymap entry!!");
else
return object;
}
if (CONSP (tem) && EQ (XCAR (tem), Qkeymap))
XSETCAR (elt, Fcopy_keymap (tem));
tem = XCDR (elt);
- if (CONSP (tem) && CONSP (XCAR (tem)))
- /* Delete cache for key equivalences. */
- XSETCDR (elt, XCDR (tem));
}
}
else
elt = XCDR (elt);
tem = XCDR (elt);
}
- /* There may also be a list that caches key equivalences.
- Just delete it for the new keymap. */
- if (CONSP (tem)
- && CONSP (XCAR (tem))
- && (NILP (XCAR (XCAR (tem)))
- || VECTORP (XCAR (XCAR (tem)))))
- {
- XSETCDR (elt, XCDR (tem));
- tem = XCDR (tem);
- }
if (CONSP (tem) && EQ (XCAR (tem), Qkeymap))
XSETCDR (elt, Fcopy_keymap (tem));
}
c = reorder_modifiers (c);
keystring = concat2 (build_string (new_mods), XCDR (assoc));
- error ((modifiers & ~meta_modifier
- ? "To bind the key %s, use [?%s], not [%s]"
- : "To bind the key %s, use \"%s\", not [%s]"),
+ error ("To bind the key %s, use [?%s], not [%s]",
SDATA (SYMBOL_NAME (c)), SDATA (keystring),
SDATA (SYMBOL_NAME (c)));
}
static void
accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, Lisp_Object args, void *data)
-/* Use void* data to be compatible with map_keymap_function_t. */
+/* Use void * data to be compatible with map_keymap_function_t. */
{
struct accessible_keymaps_data *d = data; /* Cast! */
Lisp_Object maps = d->maps;
that use the modifier key specified in `where-is-preferred-modifier'
\(or their meta variants) and entirely reject menu bindings.
-If optional 4th arg NOINDIRECT is non-nil, don't follow indirections
-to other keymaps or slots. This makes it possible to search for an
-indirect definition itself.
+If optional 4th arg NOINDIRECT is non-nil, don't extract the commands inside
+menu-items. This makes it possible to search for a menu-item itself.
The optional 5th arg NO-REMAP alters how command remapping is handled:
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);
}
}
Vminor_mode_overriding_map_alist = Qnil;
DEFVAR_LISP ("emulation-mode-map-alists", Vemulation_mode_map_alists,
- doc: /* List of keymap alists to use for emulations modes.
+ doc: /* List of keymap alists to use for emulation modes.
It is intended for modes or packages using multiple minor-mode keymaps.
Each element is a keymap alist just like `minor-mode-map-alist', or a
symbol with a variable binding which is a keymap alist, and it is used