- Copyright (C) 1985-1988, 1993-1995, 1998-2012 Free Software Foundation, Inc.
+ Copyright (C) 1985-1988, 1993-1995, 1998-2013 Free Software
+ Foundation, Inc.
-/* 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;
static Lisp_Object Qkeymapp, Qnon_ascii;
Lisp_Object Qkeymap, Qmenu_item, Qremap;
static Lisp_Object QCadvertised_binding;
static void describe_translation (Lisp_Object, Lisp_Object);
static void describe_map (Lisp_Object, Lisp_Object,
void (*) (Lisp_Object, Lisp_Object),
static void describe_translation (Lisp_Object, Lisp_Object);
static void describe_map (Lisp_Object, Lisp_Object,
void (*) (Lisp_Object, Lisp_Object),
- int, Lisp_Object, Lisp_Object*, int, int);
+ bool, Lisp_Object, Lisp_Object*, bool, bool);
static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object,
static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object,
- void (*) (Lisp_Object, Lisp_Object), int,
- Lisp_Object, Lisp_Object, int, int);
+ void (*) (Lisp_Object, Lisp_Object), bool,
+ Lisp_Object, Lisp_Object, bool, bool);
-static Lisp_Object get_keyelt (Lisp_Object, int);
+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);
+}
/* Check that OBJECT is a keymap (after dereferencing through any
symbols). If it is, return it.
/* Check that OBJECT is a keymap (after dereferencing through any
symbols). If it is, return it.
- If AUTOLOAD is nonzero, callers must assume GC is possible.
-
- If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR
- is zero as well), return Qt.
+ If AUTOLOAD, callers must assume GC is possible.
but it seems to me that only read_key_sequence, Flookup_key, and
Fdefine_key should cause keymaps to be autoloaded.
but it seems to me that only read_key_sequence, Flookup_key, and
Fdefine_key should cause keymaps to be autoloaded.
keymap_memberp (Lisp_Object map, Lisp_Object maps)
{
if (NILP (map)) return 0;
keymap_memberp (Lisp_Object map, Lisp_Object maps)
{
if (NILP (map)) return 0;
-access_keymap_1 (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int autoload)
+access_keymap_1 (Lisp_Object map, Lisp_Object idx,
+ bool t_ok, bool noinherit, bool autoload)
{
/* If idx is a list (some sort of mouse click, perhaps?),
the index we want to use is the car of the list, which
{
/* If idx is a list (some sort of mouse click, perhaps?),
the index we want to use is the car of the list, which
{
Lisp_Object val = access_keymap_1 (map, idx, t_ok, noinherit, autoload);
return EQ (val, Qunbound) ? Qnil : val;
{
Lisp_Object val = access_keymap_1 (map, idx, t_ok, noinherit, autoload);
return EQ (val, Qunbound) ? Qnil : val;
/* If the key is a range, make a copy since map_char_table modifies
it in place. */
if (CONSP (key))
key = Fcons (XCAR (key), XCDR (key));
/* If the key is a range, make a copy since map_char_table modifies
it in place. */
if (CONSP (key))
key = Fcons (XCAR (key), XCDR (key));
- map_keymap_item (fun, XCDR (args), key, val,
- XSAVE_VALUE (XCAR (args))->pointer);
+ map_keymap_item (fun, XSAVE_OBJECT (args, 2), key,
+ val, XSAVE_POINTER (args, 1));
- {
- map_char_table (map_keymap_char_table_item, Qnil, binding,
- Fcons (make_save_value ((void *) fun, 0),
- Fcons (make_save_value (data, 0),
- args)));
- }
+ map_char_table (map_keymap_char_table_item, Qnil, binding,
+ make_save_funcptr_ptr_obj ((voidfuncptr) fun, data,
+ args));
-map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data, int autoload)
+map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args,
+ void *data, bool autoload)
Also if OBJECT has a menu string as the first element,
remove that. Also remove a menu help string as second element.
Also if OBJECT has a menu string as the first element,
remove that. Also remove a menu help string as second element.
keymap = XCDR (keymap); /* Skip the `keymap' symbol. */
while (CONSP (keymap) && !EQ (XCAR (keymap), Qkeymap))
keymap = XCDR (keymap); /* Skip the `keymap' symbol. */
while (CONSP (keymap) && !EQ (XCAR (keymap), Qkeymap))
binding KEY to DEF is added at the front of KEYMAP. */)
(Lisp_Object keymap, Lisp_Object key, Lisp_Object def)
{
binding KEY to DEF is added at the front of KEYMAP. */)
(Lisp_Object keymap, Lisp_Object key, Lisp_Object def)
{
/* GC is possible in this function. */
DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0,
/* GC is possible in this function. */
DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0,
recognize the default bindings, just as `read-key-sequence' does. */)
(Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default)
{
recognize the default bindings, just as `read-key-sequence' does. */)
(Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default)
{
doc: /* Return a list of the currently active keymaps.
OLP if non-nil indicates that we should obey `overriding-local-map' and
`overriding-terminal-local-map'. POSITION can specify a click position
doc: /* Return a list of the currently active keymaps.
OLP if non-nil indicates that we should obey `overriding-local-map' and
`overriding-terminal-local-map'. POSITION can specify a click position
(Lisp_Object olp, Lisp_Object position)
{
ptrdiff_t count = SPECPDL_INDEX ();
(Lisp_Object olp, Lisp_Object position)
{
ptrdiff_t count = SPECPDL_INDEX ();
/* 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 a mouse click position is given, our variables are based on
the buffer clicked on, not the current buffer. So we may have to
{
/* Arrange to go back to the original buffer once we're done
processing the key sequence. We don't use
{
/* Arrange to go back to the original buffer once we're done
processing the key sequence. We don't use
/* 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. */
/* 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);
+
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 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);
struct accessible_keymaps_data {
Lisp_Object maps, tail, thisseq;
/* Does the current sequence end in the meta-prefix-char? */
struct accessible_keymaps_data {
Lisp_Object maps, tail, thisseq;
/* Does the current sequence end in the meta-prefix-char? */
Lisp_Object maps = d->maps;
Lisp_Object tail = d->tail;
Lisp_Object thisseq = d->thisseq;
Lisp_Object maps = d->maps;
Lisp_Object tail = d->tail;
Lisp_Object thisseq = d->thisseq;
Lisp_Object tem;
cmd = get_keymap (get_keyelt (cmd, 0), 0, 0);
Lisp_Object tem;
cmd = get_keymap (get_keyelt (cmd, 0), 0, 0);
- 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,
/* For each map in the list maps,
look at any other maps it points to,
Optional arg PREFIX is the sequence of keys leading up to KEYS.
For example, [?\C-x ?l] is converted into the string \"C-x l\".
Optional arg PREFIX is the sequence of keys leading up to KEYS.
For example, [?\C-x ?l] is converted into the string \"C-x l\".
/* Clear all the meaningless bits above the meta bit. */
c = ch & (meta_modifier | ~ - meta_modifier);
/* Clear all the meaningless bits above the meta bit. */
c = ch & (meta_modifier | ~ - meta_modifier);
- if (NILP (BVAR (current_buffer, enable_multibyte_characters))
- && ! force_multibyte)
- *p++ = multibyte_char_to_unibyte (c);
- else
- p += CHAR_STRING (c, (unsigned char *) p);
+ p += CHAR_STRING (c, (unsigned char *) p);
- char tem[KEY_DESCRIPTION_SIZE], *p;
-
- p = push_key_description (XINT (key), tem, 1);
+ char tem[KEY_DESCRIPTION_SIZE];
+ char *p = push_key_description (XINT (key), tem);
*p = 0;
return make_specified_string (tem, -1, p - tem, 1);
}
*p = 0;
return make_specified_string (tem, -1, p - tem, 1);
}
return Fcopy_sequence (key);
else
error ("KEY must be an integer, cons, symbol, or string");
return Fcopy_sequence (key);
else
error ("KEY must be an integer, cons, symbol, or string");
static Lisp_Object
shadow_lookup (Lisp_Object shadow, Lisp_Object key, Lisp_Object flag,
static Lisp_Object
shadow_lookup (Lisp_Object shadow, Lisp_Object key, Lisp_Object flag,
struct where_is_internal_data {
Lisp_Object definition, this, last;
struct where_is_internal_data {
Lisp_Object definition, this, last;
[M-CHAR] sequences, check if last character of the sequence
is the meta-prefix char. */
Lisp_Object last;
[M-CHAR] sequences, check if last character of the sequence
is the meta-prefix char. */
Lisp_Object last;
/* Actually relevant bindings. */
Lisp_Object found = Qnil;
/* 1 means ignore all menu bindings entirely. */
/* Actually relevant bindings. */
Lisp_Object found = Qnil;
/* 1 means ignore all menu bindings entirely. */
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
/* List of sequences found via remapping. Keep them in a separate
variable, so as to push them later, since we prefer
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
/* List of sequences found via remapping. Keep them in a separate
variable, so as to push them later, since we prefer
/* Whether or not we're handling remapped sequences. This is needed
because remapping is not done recursively by Fcommand_remapping: you
can't remap a remapped command. */
/* Whether or not we're handling remapped sequences. This is needed
because remapping is not done recursively by Fcommand_remapping: you
can't remap a remapped command. */
(Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus)
{
Lisp_Object outbuf, shadow;
(Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus)
{
Lisp_Object outbuf, shadow;
insert (buf, bufend - buf);
Findent_to (make_number (16), make_number (1));
insert (buf, bufend - buf);
Findent_to (make_number (16), make_number (1));
start1 = Qnil;
if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
start1 = KVAR (current_kboard, Voverriding_terminal_local_map);
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;
+ }
/* Insert a description of the key bindings in STARTMAP,
followed by those of all maps reachable through STARTMAP.
/* Insert a description of the key bindings in STARTMAP,
followed by those of all maps reachable through STARTMAP.
(such as `undefined').
If SHADOW is non-nil, it is a list of maps;
don't mention keys which would be shadowed by any of them.
PREFIX, if non-nil, says mention only keys that start with PREFIX.
TITLE, if not 0, is a string to insert at the beginning.
TITLE should not end with a colon or a newline; we supply that.
(such as `undefined').
If SHADOW is non-nil, it is a list of maps;
don't mention keys which would be shadowed by any of them.
PREFIX, if non-nil, says mention only keys that start with PREFIX.
TITLE, if not 0, is a string to insert at the beginning.
TITLE should not end with a colon or a newline; we supply that.
don't omit it; instead, mention it but say it is shadowed.
Any inserted text ends in two newlines (used by `help-make-xrefs'). */
void
don't omit it; instead, mention it but say it is shadowed.
Any inserted text ends in two newlines (used by `help-make-xrefs'). */
void
-describe_map_tree (Lisp_Object startmap, int partial, Lisp_Object shadow,
- Lisp_Object prefix, const char *title, int nomenu, int transl,
- int always_title, int mention_shadow)
+describe_map_tree (Lisp_Object startmap, bool partial, Lisp_Object shadow,
+ Lisp_Object prefix, const char *title, bool nomenu,
+ bool transl, bool always_title, bool mention_shadow)
{
Lisp_Object maps, orig_maps, seen, sub_shadows;
struct gcpro gcpro1, gcpro2, gcpro3;
{
Lisp_Object maps, orig_maps, seen, sub_shadows;
struct gcpro gcpro1, gcpro2, gcpro3;
into an array of `struct describe_map_elt',
then sorts them by the events. */
into an array of `struct describe_map_elt',
then sorts them by the events. */
static void
describe_map (Lisp_Object map, Lisp_Object prefix,
void (*elt_describer) (Lisp_Object, Lisp_Object),
static void
describe_map (Lisp_Object map, Lisp_Object prefix,
void (*elt_describer) (Lisp_Object, Lisp_Object),
- int partial, Lisp_Object shadow,
- Lisp_Object *seen, int nomenu, int mention_shadow)
+ bool partial, Lisp_Object shadow,
+ Lisp_Object *seen, bool nomenu, bool mention_shadow)
struct gcpro gcpro1, gcpro2, gcpro3;
/* These accumulate the values from sparse keymap bindings,
struct gcpro gcpro1, gcpro2, gcpro3;
/* These accumulate the values from sparse keymap bindings,
static void
describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
void (*elt_describer) (Lisp_Object, Lisp_Object),
static void
describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
void (*elt_describer) (Lisp_Object, Lisp_Object),
- int partial, Lisp_Object shadow, Lisp_Object entire_map,
- int keymap_p, int mention_shadow)
+ bool partial, Lisp_Object shadow, Lisp_Object entire_map,
+ bool keymap_p, bool mention_shadow)
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
/* Range of elements to be handled. */
int from, to, stop;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
/* Range of elements to be handled. */
int from, to, stop;