# HG changeset patch # User Richard M. Stallman # Date 775899540 0 # Node ID b4138573c00f564fdeaf15734586199cb040ad7d # Parent 356e5509efda3d00b4784294812a50280f745c49 (Faccessible_keymaps): Use PREFIX to set loop starting point; don't even consider maps except those reached via prefix. diff -r 356e5509efda -r b4138573c00f src/keymap.c --- a/src/keymap.c Wed Aug 03 07:35:50 1994 +0000 +++ b/src/keymap.c Wed Aug 03 07:39:00 1994 +0000 @@ -1164,9 +1164,23 @@ if (!NILP (prefix)) prefixlen = XINT (Flength (prefix)); - maps = Fcons (Fcons (Fmake_vector (make_number (0), Qnil), - get_keymap (startmap)), - Qnil); + if (!NILP (prefix)) + { + /* If a prefix was specified, start with the keymap (if any) for + that prefix, so we don't waste time considering other prefixes. */ + Lisp_Object tem; + tem = Flookup_key (startmap, prefix, Qt); + /* If PREFIX is reasonable, Flookup_key should give a keymap or nil. + For any other value it is ok to get an error here. */ + if (!NILP (tem)) + maps = Fcons (Fcons (prefix, get_keymap (tem)), Qnil); + else + return Qnil; + } + else + maps = Fcons (Fcons (Fmake_vector (make_number (0), Qnil), + get_keymap (startmap)), + Qnil); /* For each map in the list maps, look at any other maps it points to,