(map)
Lisp_Object map;
{
+ map = get_keymap (map, 0, 0);
while (CONSP (map))
{
- register Lisp_Object tem;
- tem = Fcar (map);
+ Lisp_Object tem = XCAR (map);
if (STRINGP (tem))
return tem;
- map = Fcdr (map);
+ map = XCDR (map);
}
return Qnil;
}
/* Should we do an autoload? Autoload forms for keymaps have
Qkeymap as their fifth element. */
- if ((autoload || !error) && EQ (XCAR (tem), Qautoload))
+ if ((autoload || !error) && EQ (XCAR (tem), Qautoload)
+ && SYMBOLP (object))
{
Lisp_Object tail;
call2 (fun, key, val);
}
-DEFUN ("map-keymap", Fmap_keymap, Smap_keymap, 2, 2, 0,
+DEFUN ("map-keymap", Fmap_keymap, Smap_keymap, 2, 3, 0,
doc: /* Call FUNCTION for every binding in KEYMAP.
FUNCTION is called with two arguments: the event and its binding.
If KEYMAP has a parent, the parent's bindings are included as well.
This works recursively: if the parent has itself a parent, then the
-grandparent's bindings are also included and so on. */)
- (function, keymap)
- Lisp_Object function, keymap;
+grandparent's bindings are also included and so on.
+usage: (map-keymap FUNCTION KEYMAP) */)
+ (function, keymap, sort_first)
+ Lisp_Object function, keymap, sort_first;
{
if (INTEGERP (function))
/* We have to stop integers early since map_keymap gives them special
significance. */
Fsignal (Qinvalid_function, Fcons (function, Qnil));
+ if (! NILP (sort_first))
+ return call3 (intern ("map-keymap-internal"), function, keymap, Qt);
+
map_keymap (keymap, map_keymap_call, function, NULL, 1);
return Qnil;
}
c = Fevent_convert_list (c);
/* Turn the 8th bit of string chars into a meta modifier. */
- if (XINT (c) & 0x80 && STRINGP (key))
+ if (INTEGERP (c) && XINT (c) & 0x80 && STRINGP (key))
XSETINT (c, (XINT (c) | meta_modifier) & ~0x80);
/* Allow string since binding for `menu-bar-select-buffer'
if (!NILP (olp))
{
- if (!NILP (Voverriding_local_map))
- keymaps = Fcons (Voverriding_local_map, keymaps);
if (!NILP (current_kboard->Voverriding_terminal_local_map))
keymaps = Fcons (current_kboard->Voverriding_terminal_local_map, keymaps);
+ /* 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);
}
if (NILP (XCDR (keymaps)))
{
Lisp_Object *maps;
int nmaps, i;
+ /* This usually returns the buffer's local map,
+ but that can be overridden by a `local-map' property. */
local = get_local_map (PT, current_buffer, Qlocal_map);
if (!NILP (local))
keymaps = Fcons (local, keymaps);
+ /* Now put all the minor mode keymaps on the list. */
nmaps = current_minor_maps (0, &maps);
for (i = --nmaps; i >= 0; i--)
if (!NILP (maps[i]))
keymaps = Fcons (maps[i], keymaps);
+ /* This returns nil unless there is a `keymap' property. */
local = get_local_map (PT, current_buffer, Qkeymap);
if (!NILP (local))
keymaps = Fcons (local, keymaps);