a cons (STRING . DEFN), meaning that DEFN is the definition
(DEFN should be a valid definition in its own right),
or a cons (MAP . CHAR), meaning use definition of CHAR in keymap MAP,
- or an extended menu item definition. (See info node `Extended Menu Items'.)
+ or an extended menu item definition.
+ (See info node `(elisp)Extended Menu Items'.)
If KEYMAP is a sparse keymap with a binding for KEY, the existing
binding is altered. If there is no binding for KEY, the new pair
if (SYMBOLP (def) && !EQ (Vdefine_key_rebound_commands, Qt))
Vdefine_key_rebound_commands = Fcons (def, Vdefine_key_rebound_commands);
- meta_bit = VECTORP (key) ? meta_modifier : 0x80;
+ meta_bit = (VECTORP (key) || STRINGP (key) && STRING_MULTIBYTE (key)
+ ? meta_modifier : 0x80);
if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0)))
{ /* DEF is apparently an XEmacs-style keyboard macro. */
/* This function may GC (it calls Fkey_binding). */
-DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 2, 0,
- doc: /* Return the remapping for command COMMAND in current keymaps.
+DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 3, 0,
+ doc: /* Return the remapping for command COMMAND.
Returns nil if COMMAND is not remapped (or not a symbol).
If the optional argument POSITION is non-nil, it specifies a mouse
position as returned by `event-start' and `event-end', and the
remapping occurs in the keymaps associated with it. It can also be a
number or marker, in which case the keymap properties at the specified
-buffer position instead of point are used. */)
- (command, position)
- Lisp_Object command, position;
+buffer position instead of point are used. The KEYMAPS argument is
+ignored if POSITION is non-nil.
+
+If the optional argument KEYMAPS is non-nil, it should be a list of
+keymaps to search for command remapping. Otherwise, search for the
+remapping in all currently active keymaps. */)
+ (command, position, keymaps)
+ Lisp_Object command, position, keymaps;
{
if (!SYMBOLP (command))
return Qnil;
ASET (command_remapping_vector, 1, command);
- return Fkey_binding (command_remapping_vector, Qnil, Qt, position);
+
+ if (NILP (keymaps))
+ return Fkey_binding (command_remapping_vector, Qnil, Qt, position);
+ else
+ {
+ Lisp_Object maps, binding;
+
+ for (maps = keymaps; !NILP (maps); maps = Fcdr (maps))
+ {
+ binding = Flookup_key (Fcar (maps), command_remapping_vector, Qnil);
+ if (!NILP (binding) && !INTEGERP (binding))
+ return binding;
+ }
+ return Qnil;
+ }
}
/* Value is number if KEY is too long; nil if valid but has no definition. */
c = Fevent_convert_list (c);
/* Turn the 8th bit of string chars into a meta modifier. */
- if (INTEGERP (c) && XINT (c) & 0x80 && STRINGP (key))
+ if (STRINGP (key) && XINT (c) & 0x80 && !STRING_MULTIBYTE (key))
XSETINT (c, (XINT (c) | meta_modifier) & ~0x80);
/* Allow string since binding for `menu-bar-select-buffer'
static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL;
static int cmm_size = 0;
-/* Store a pointer to an array of the keymaps of the currently active
- minor modes in *buf, and return the number of maps it contains.
+/* Store a pointer to an array of the currently active minor modes in
+ *modeptr, a pointer to an array of the keymaps of the currently
+ active minor modes in *mapptr, and return the number of maps
+ *mapptr contains.
This function always returns a pointer to the same buffer, and may
free or reallocate it, so if you want to keep it for a long time or
if (NILP (no_remap) && SYMBOLP (value))
{
Lisp_Object value1;
- if (value1 = Fcommand_remapping (value, position), !NILP (value1))
+ if (value1 = Fcommand_remapping (value, position, Qnil), !NILP (value1))
value = value1;
}
/* 1 means ignore all menu bindings entirely. */
int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii);
- /* If this command is remapped, then it has no key bindings
- of its own. */
- if (NILP (no_remap) && SYMBOLP (definition))
- {
- Lisp_Object tem;
- if (tem = Fcommand_remapping (definition, Qnil), !NILP (tem))
- return Qnil;
- }
-
found = keymaps;
while (CONSP (found))
{
found = Qnil;
sequences = Qnil;
+ /* If this command is remapped, then it has no key bindings
+ of its own. */
+ if (NILP (no_remap)
+ && SYMBOLP (definition)
+ && !NILP (Fcommand_remapping (definition, Qnil, keymaps)))
+ RETURN_UNGCPRO (Qnil);
+
for (; !NILP (maps); maps = Fcdr (maps))
{
/* Key sequence to reach map, and the map that it reaches */
You type Translation\n\
-------- -----------\n";
+ CHECK_BUFFER (buffer);
+
shadow = Qnil;
GCPRO1 (shadow);