HCoop
/
bpt
/
emacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-7
[bpt/emacs.git]
/
src
/
keymap.c
diff --git
a/src/keymap.c
b/src/keymap.c
index
5177ccf
..
2977b4d
100644
(file)
--- a/
src/keymap.c
+++ b/
src/keymap.c
@@
-1,6
+1,6
@@
/* Manipulation of keymaps
/* Manipulation of keymaps
- Copyright (C) 1985,
86,87,88,93,94,95,98,99, 2000, 01, 2004
- Free Software Foundation, Inc.
+ Copyright (C) 1985,
1986, 1987, 1988, 1993, 1994, 1995, 1998, 1999, 2000,
+
2001, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Emacs.
This file is part of GNU Emacs.
@@
-214,13
+214,13
@@
when reading a key-sequence to be looked-up in this keymap. */)
(map)
Lisp_Object map;
{
(map)
Lisp_Object map;
{
+ map = get_keymap (map, 0, 0);
while (CONSP (map))
{
while (CONSP (map))
{
- register Lisp_Object tem;
- tem = Fcar (map);
+ Lisp_Object tem = XCAR (map);
if (STRINGP (tem))
return tem;
if (STRINGP (tem))
return tem;
- map =
Fcdr
(map);
+ map =
XCDR
(map);
}
return Qnil;
}
}
return Qnil;
}
@@
-268,7
+268,8
@@
get_keymap (object, error, autoload)
/* Should we do an autoload? Autoload forms for keymaps have
Qkeymap as their fifth element. */
/* 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;
{
Lisp_Object tail;
@@
-524,6
+525,10
@@
access_keymap (map, idx, t_ok, noinherit, autoload)
struct gcpro gcpro1;
Lisp_Object meta_map;
GCPRO1 (map);
struct gcpro gcpro1;
Lisp_Object meta_map;
GCPRO1 (map);
+ /* A strange value in which Meta is set would cause
+ infinite recursion. Protect against that. */
+ if (XINT (meta_prefix_char) & CHAR_META)
+ meta_prefix_char = make_number (27);
meta_map = get_keymap (access_keymap (map, meta_prefix_char,
t_ok, noinherit, autoload),
0, autoload);
meta_map = get_keymap (access_keymap (map, meta_prefix_char,
t_ok, noinherit, autoload),
0, autoload);
@@
-702,19
+707,23
@@
map_keymap_call (key, val, fun, dummy)
call2 (fun, key, val);
}
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
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 (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;
}
map_keymap (keymap, map_keymap_call, function, NULL, 1);
return Qnil;
}
@@
-1268,7
+1277,7
@@
recognize the default bindings, just as `read-key-sequence' does. */)
c = Fevent_convert_list (c);
/* Turn the 8th bit of string chars into a meta modifier. */
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'
XSETINT (c, (XINT (c) | meta_modifier) & ~0x80);
/* Allow string since binding for `menu-bar-select-buffer'
@@
-1514,10
+1523,13
@@
OLP if non-nil indicates that we should obey `overriding-local-map' and
if (!NILP (olp))
{
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);
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)))
{
}
if (NILP (XCDR (keymaps)))
{
@@
-1525,16
+1537,20
@@
OLP if non-nil indicates that we should obey `overriding-local-map' and
Lisp_Object *maps;
int nmaps, i;
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);
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);
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);
local = get_local_map (PT, current_buffer, Qkeymap);
if (!NILP (local))
keymaps = Fcons (local, keymaps);