summaryrefslogtreecommitdiff
path: root/src/keymap.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-08-03 07:39:00 +0000
committerRichard M. Stallman <rms@gnu.org>1994-08-03 07:39:00 +0000
commit8e23c287d9678fcc2c58b3a4f7e79b0fa8832e5c (patch)
tree0988c87df6b7e006f5988795eb4f731d68f0f3e7 /src/keymap.c
parentf30d5be1223d880a07efa4631dfc99958ac853e1 (diff)
downloademacs-8e23c287d9678fcc2c58b3a4f7e79b0fa8832e5c.tar.gz
(Faccessible_keymaps): Use PREFIX to set loop starting
point; don't even consider maps except those reached via prefix.
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 3ae7d7e3608..dea8f883f6f 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1164,9 +1164,23 @@ then the value includes only maps for prefixes that start with PREFIX.")
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,