* doc/lispref/keymaps.texi (Key Lookup): Remove mention of indirect entries.

(Scanning Keymaps): Reword the `noindirect' argument.
* src/keymap.c (get_keyelt): Simplify.
(copy_keymap_item): Remove left-over code for when we had
key-shortcut caches.
This commit is contained in:
Stefan Monnier 2014-07-01 21:49:31 -04:00
parent 8b3c1354a9
commit 1dc6f7e738
4 changed files with 20 additions and 65 deletions

View file

@ -1,3 +1,8 @@
2014-07-02 Stefan Monnier <monnier@iro.umontreal.ca>
* keymaps.texi (Key Lookup): Remove mention of indirect entries.
(Scanning Keymaps): Reword the `noindirect' argument.
2014-06-28 Glenn Morris <rgm@gnu.org>
* minibuf.texi (Intro to Minibuffers): Batch mode is basic.

View file

@ -1043,22 +1043,6 @@ lambda expression. This is presumed to be a function, and is treated
as such (see above). In order to execute properly as a key binding,
this function must be a command---it must have an @code{interactive}
specification. @xref{Defining Commands}.
@item
If the @sc{car} of @var{list} is a keymap and the @sc{cdr} is an event
type, then this is an @dfn{indirect entry}:
@example
(@var{othermap} . @var{othertype})
@end example
When key lookup encounters an indirect entry, it looks up instead the
binding of @var{othertype} in @var{othermap} and uses that.
This feature permits you to define one key as an alias for another key.
For example, an entry whose @sc{car} is the keymap called @code{esc-map}
and whose @sc{cdr} is 32 (the code for @key{SPC}) means, ``Use the global
binding of @kbd{Meta-@key{SPC}}, whatever that may be''.
@end itemize
@item @var{symbol}
@ -1066,9 +1050,7 @@ binding of @kbd{Meta-@key{SPC}}, whatever that may be''.
The function definition of @var{symbol} is used in place of
@var{symbol}. If that too is a symbol, then this process is repeated,
any number of times. Ultimately this should lead to an object that is
a keymap, a command, or a keyboard macro. A list is allowed if it is a
keymap or a command, but indirect entries are not understood when found
via symbols.
a keymap, a command, or a keyboard macro.
Note that keymaps and keyboard macros (strings and vectors) are not
valid functions, so a symbol with a keymap, string, or vector as its
@ -1097,8 +1079,7 @@ binding is not executable as a command.
@end table
In short, a keymap entry may be a keymap, a command, a keyboard
macro, a symbol that leads to one of them, or an indirection or
@code{nil}.
macro, a symbol that leads to one of them, or @code{nil}.
@node Functions for Key Lookup
@section Functions for Key Lookup
@ -1945,9 +1926,9 @@ entirely of @acronym{ASCII} characters (or meta variants of @acronym{ASCII}
characters) are preferred to all other key sequences and that the
return value can never be a menu binding.
If @var{noindirect} is non-@code{nil}, @code{where-is-internal} doesn't
follow indirect keymap bindings. This makes it possible to search for
an indirect definition itself.
If @var{noindirect} is non-@code{nil}, @code{where-is-internal} doesn't look
inside menu-items to find their commands. This makes it possible to search for
a menu-item itself.
The fifth argument, @var{no-remap}, determines how this function
treats command remappings (@pxref{Remapping Commands}). There are two

View file

@ -1,3 +1,9 @@
2014-07-02 Stefan Monnier <monnier@iro.umontreal.ca>
* keymap.c (get_keyelt): Simplify.
(copy_keymap_item): Remove left-over code for when we had
key-shortcut caches.
2014-06-30 Jan Djärv <jan.h.d@swipnet.se>
* nsterm.m (judge): EmacsScroller: Move dealloc code here.
@ -19,8 +25,7 @@
(mouseMoved:): Set any_help_event_p to YES if help event is
generated. Remove else with empty help event that triggered redisplay
for every mouse move.
(windowDidResignKey:): If any_help_event_p, generate empty help
event.
(windowDidResignKey:): If any_help_event_p, generate empty help event.
2014-06-29 Dmitry Antipov <dmantipov@yandex.ru>

View file

@ -727,11 +727,6 @@ get_keyelt (Lisp_Object object, bool autoload)
/* This is really the value. */
return object;
/* If the keymap contents looks like (keymap ...) or (lambda ...)
then use itself. */
else if (EQ (XCAR (object), Qkeymap) || EQ (XCAR (object), Qlambda))
return object;
/* If the keymap contents looks like (menu-item name . DEFN)
or (menu-item name DEFN ...) then use DEFN.
This is a new format menu item. */
@ -768,25 +763,8 @@ get_keyelt (Lisp_Object object, bool autoload)
Keymap alist elements like (CHAR MENUSTRING . DEFN)
will be used by HierarKey menus. */
else if (STRINGP (XCAR (object)))
{
object = XCDR (object);
/* Also remove a menu help string, if any,
following the menu item name. */
if (CONSP (object) && STRINGP (XCAR (object)))
object = XCDR (object);
/* Also remove the sublist that caches key equivalences, if any. */
if (CONSP (object) && CONSP (XCAR (object)))
{
Lisp_Object carcar;
carcar = XCAR (XCAR (object));
if (NILP (carcar) || VECTORP (carcar))
object = XCDR (object);
}
}
object = XCDR (object);
/* If the contents are (KEYMAP . ELEMENT), go indirect. */
else if (KEYMAPP (XCAR (object)))
error ("Wow, indirect keymap entry!!");
else
return object;
}
@ -990,9 +968,6 @@ copy_keymap_item (Lisp_Object elt)
if (CONSP (tem) && EQ (XCAR (tem), Qkeymap))
XSETCAR (elt, Fcopy_keymap (tem));
tem = XCDR (elt);
if (CONSP (tem) && CONSP (XCAR (tem)))
/* Delete cache for key equivalences. */
XSETCDR (elt, XCDR (tem));
}
}
else
@ -1011,16 +986,6 @@ copy_keymap_item (Lisp_Object elt)
elt = XCDR (elt);
tem = XCDR (elt);
}
/* There may also be a list that caches key equivalences.
Just delete it for the new keymap. */
if (CONSP (tem)
&& CONSP (XCAR (tem))
&& (NILP (XCAR (XCAR (tem)))
|| VECTORP (XCAR (XCAR (tem)))))
{
XSETCDR (elt, XCDR (tem));
tem = XCDR (tem);
}
if (CONSP (tem) && EQ (XCAR (tem), Qkeymap))
XSETCDR (elt, Fcopy_keymap (tem));
}
@ -2572,9 +2537,8 @@ If FIRSTONLY has another non-nil value, prefer bindings
that use the modifier key specified in `where-is-preferred-modifier'
\(or their meta variants) and entirely reject menu bindings.
If optional 4th arg NOINDIRECT is non-nil, don't follow indirections
to other keymaps or slots. This makes it possible to search for an
indirect definition itself.
If optional 4th arg NOINDIRECT is non-nil, don't extract the commands inside
menu-items. This makes it possible to search for a menu-item itself.
The optional 5th arg NO-REMAP alters how command remapping is handled: