- while (CONSP (map))
- {
- /* Because the code we want to run on each binding is rather
- large, we don't want to have two separate loop bodies for
- sparse keymap bindings and tables; we want to iterate one
- loop body over both keymap and vector bindings.
-
- For this reason, if Fcar (map) is a vector, we don't
- advance map to the next element until i indicates that we
- have finished off the vector. */
- Lisp_Object elt, key, binding;
- elt = XCAR (map);
- map = XCDR (map);
-
- sequences = Qnil;
-
- QUIT;
-
- /* Set key and binding to the current key and binding, and
- advance map and i to the next binding. */
- if (VECTORP (elt))
- {
- Lisp_Object sequence;
- int i;
- /* In a vector, look at each element. */
- for (i = 0; i < XVECTOR (elt)->size; i++)
- {
- binding = AREF (elt, i);
- XSETFASTINT (key, i);
- sequence = where_is_internal_1 (binding, key, definition,
- noindirect, this,
- last, nomenus, last_is_meta);
- if (!NILP (sequence))
- sequences = Fcons (sequence, sequences);
- }
- }
- else if (CHAR_TABLE_P (elt))
- {
- Lisp_Object indices[3];
- Lisp_Object args;
-
- args = Fcons (Fcons (Fcons (definition, noindirect),
- Qnil), /* Result accumulator. */
- Fcons (Fcons (this, last),
- Fcons (make_number (nomenus),
- make_number (last_is_meta))));
- map_char_table (where_is_internal_2, Qnil, elt, elt, args,
- 0, indices);
- sequences = XCDR (XCAR (args));
- }
- else if (CONSP (elt))
- {
- Lisp_Object sequence;
-
- key = XCAR (elt);
- binding = XCDR (elt);
-
- sequence = where_is_internal_1 (binding, key, definition,
- noindirect, this,
- last, nomenus, last_is_meta);
- if (!NILP (sequence))
- sequences = Fcons (sequence, sequences);
- }
-
-
- while (!NILP (sequences))
- {
- Lisp_Object sequence, remapped, function;
-
- sequence = XCAR (sequences);
- sequences = XCDR (sequences);
-
- /* If the current sequence is a command remapping with
- format [remap COMMAND], find the key sequences
- which run COMMAND, and use those sequences instead. */
- remapped = Qnil;
- if (NILP (no_remap)
- && VECTORP (sequence) && XVECTOR (sequence)->size == 2
- && EQ (AREF (sequence, 0), Qremap)
- && (function = AREF (sequence, 1), SYMBOLP (function)))
- {
- Lisp_Object remapped1;
-
- remapped1 = where_is_internal (function, keymaps, firstonly, noindirect, Qt);
- if (CONSP (remapped1))
- {
- /* Verify that this key binding actually maps to the
- remapped command (see below). */
- if (!EQ (shadow_lookup (keymaps, XCAR (remapped1), Qnil), function))
- continue;
- sequence = XCAR (remapped1);
- remapped = XCDR (remapped1);
- goto record_sequence;
- }
- }
-
- /* Verify that this key binding is not shadowed by another
- binding for the same key, before we say it exists.