#include "intervals.h"
#define min(a, b) ((a) < (b) ? (a) : (b))
+#define KEYMAPP(m) (!NILP (Fkeymapp (m)))
/* The number of elements in keymap vectors. */
#define DENSE_TABLE_SIZE (0200)
extern Lisp_Object Voverriding_local_map;
-static Lisp_Object define_as_prefix ();
-static Lisp_Object describe_buffer_bindings ();
-static void describe_command (), describe_translation ();
-static void describe_map ();
+static Lisp_Object store_in_keymap P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
+static void fix_submap_inheritance P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
+
+static Lisp_Object define_as_prefix P_ ((Lisp_Object, Lisp_Object));
+static Lisp_Object describe_buffer_bindings P_ ((Lisp_Object));
+static void describe_command P_ ((Lisp_Object));
+static void describe_translation P_ ((Lisp_Object));
+static void describe_map P_ ((Lisp_Object, Lisp_Object,
+ void (*) P_ ((Lisp_Object)),
+ int, Lisp_Object, Lisp_Object*, int));
\f
/* Keymap object support - constructors and predicates. */
(object)
Lisp_Object object;
{
+ /* FIXME: Maybe this should return t for autoloaded keymaps? -sm */
return (NILP (get_keymap_1 (object, 0, 0)) ? Qnil : Qt);
}
for (; CONSP (list); list = XCDR (list))
{
/* See if there is another `keymap'. */
- if (EQ (Qkeymap, XCAR (list)))
+ if (KEYMAPP (list))
return list;
}
list = XCDR (prev);
/* If there is a parent keymap here, replace it.
If we came to the end, add the parent in PREV. */
- if (! CONSP (list) || EQ (Qkeymap, XCAR (list)))
+ if (! CONSP (list) || KEYMAPP (list))
{
/* If we already have the right parent, return now
so that we avoid the loops below. */
if EVENT is also a prefix in MAP's parent,
make sure that SUBMAP inherits that definition as its own parent. */
-void
+static void
fix_submap_inheritance (map, event, submap)
Lisp_Object map, event, submap;
{
}
}
-Lisp_Object
+static Lisp_Object
store_in_keymap (keymap, idx, def)
Lisp_Object keymap;
register Lisp_Object idx;
BLOCK_INPUT;
cmm_size = 30;
newmodes
- = (Lisp_Object *) malloc (cmm_size * sizeof (Lisp_Object));
+ = (Lisp_Object *) xmalloc (cmm_size * sizeof (Lisp_Object));
newmaps
- = (Lisp_Object *) malloc (cmm_size * sizeof (Lisp_Object));
+ = (Lisp_Object *) xmalloc (cmm_size * sizeof (Lisp_Object));
UNBLOCK_INPUT;
}
register unsigned int c;
register char *p;
{
+ unsigned c2;
+
/* Clear all the meaningless bits above the meta bit. */
c &= meta_modifier | ~ - meta_modifier;
+ c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier
+ | meta_modifier | shift_modifier | super_modifier);
if (c & alt_modifier)
{
*p++ = '-';
c -= alt_modifier;
}
- if (c & ctrl_modifier)
+ if ((c & ctrl_modifier) != 0
+ || (c2 < ' ' && c2 != 27 && c2 != '\t' && c2 != Ctl ('M')))
{
*p++ = 'C';
*p++ = '-';
- c -= ctrl_modifier;
+ c &= ~ctrl_modifier;
}
if (c & hyper_modifier)
{
}
else
{
- *p++ = 'C';
- *p++ = '-';
+ /* `C-' already added above. */
if (c > 0 && c <= Ctl ('Z'))
*p++ = c + 0140;
else